Falkon Develop
Cross-platform Qt-based web browser
historytreeview.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef HISTORYTREEVIEW_H
19#define HISTORYTREEVIEW_H
20
21#include <QTreeView>
22
23class History;
25class HeaderView;
26
27class HistoryTreeView : public QTreeView
28{
29 Q_OBJECT
30public:
31 enum ViewType {
34 };
35
36 explicit HistoryTreeView(QWidget* parent = nullptr);
37
38 ViewType viewType() const;
39 void setViewType(ViewType type);
40
41 // Returns empty url if more than one (or zero) urls are selected
42 QUrl selectedUrl() const;
43
44 HeaderView* header() const;
45
46Q_SIGNALS:
47 // Open url in current tab
48 void urlActivated(const QUrl &url);
49 // Open url in new tab
50 void urlCtrlActivated(const QUrl &url);
51 // Open url in new window
52 void urlShiftActivated(const QUrl &url);
53 // Context menu signal with point mapped to global
54 void contextMenuRequested(const QPoint &point);
55
56public Q_SLOTS:
57 void search(const QString &string);
59
60protected:
61 void contextMenuEvent(QContextMenuEvent* event) override;
62 void mouseMoveEvent(QMouseEvent* event) override;
63 void mousePressEvent(QMouseEvent* event) override;
64 void mouseReleaseEvent(QMouseEvent* event) override;
65 void mouseDoubleClickEvent(QMouseEvent* event) override;
66 void keyPressEvent(QKeyEvent* event) override;
67
68 void drawRow(QPainter* painter, const QStyleOptionViewItem &options, const QModelIndex &index) const override;
69
70private:
71 History* m_history;
72 HistoryFilterModel* m_filter;
73 HeaderView* m_header;
74 ViewType m_type;
75};
76
77#endif // HISTORYTREEVIEW_H
QUrl selectedUrl() const
void setViewType(ViewType type)
void mousePressEvent(QMouseEvent *event) override
void urlCtrlActivated(const QUrl &url)
void mouseReleaseEvent(QMouseEvent *event) override
void urlShiftActivated(const QUrl &url)
HeaderView * header() const
HistoryTreeView(QWidget *parent=nullptr)
void contextMenuRequested(const QPoint &point)
void keyPressEvent(QKeyEvent *event) override
void drawRow(QPainter *painter, const QStyleOptionViewItem &options, const QModelIndex &index) const override
ViewType viewType() const
void urlActivated(const QUrl &url)
void search(const QString &string)
void contextMenuEvent(QContextMenuEvent *event) override
void mouseMoveEvent(QMouseEvent *event) override
void mouseDoubleClickEvent(QMouseEvent *event) override