1 /* profile_tree_view.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #ifndef PROFILE_TREEVIEW_H
11 #define PROFILE_TREEVIEW_H
12 
13 #include <ui/qt/models/url_link_delegate.h>
14 
15 #include <QTreeView>
16 #include <QItemDelegate>
17 
18 class ProfileUrlLinkDelegate : public UrlLinkDelegate
19 {
20     Q_OBJECT
21 
22 public:
23     explicit ProfileUrlLinkDelegate(QObject *parent = Q_NULLPTR);
24 
25     virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
26 };
27 
28 class ProfileTreeEditDelegate : public QItemDelegate
29 {
30     Q_OBJECT
31 public:
32     ProfileTreeEditDelegate(QWidget *parent = Q_NULLPTR);
33 
34     // QAbstractItemDelegate interface
35     virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
36 
37 private:
38     QWidget * editor_;
39     QModelIndex index_;
40 };
41 
42 class ProfileTreeView : public QTreeView
43 {
44     Q_OBJECT
45 public:
46     ProfileTreeView(QWidget *parent = nullptr);
47     ~ProfileTreeView();
48 
49     void selectRow(int row);
50     bool activeEdit();
51 
52 Q_SIGNALS:
53     void itemUpdated();
54 
55     // QWidget interface
56 protected:
57     virtual void mouseDoubleClickEvent(QMouseEvent *event);
58 
59     // QAbstractItemView interface
60 protected slots:
61     virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
62     virtual void clicked(const QModelIndex &index);
63 
64 private:
65     ProfileTreeEditDelegate *delegate_;
66 
67 };
68 
69 #endif
70