Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
profile_tree_view.h
Go to the documentation of this file.
1
9
10#ifndef PROFILE_TREEVIEW_H
11#define PROFILE_TREEVIEW_H
12
14
15#include <QTreeView>
16#include <QItemDelegate>
17
22class ProfileTreeEditDelegate : public QItemDelegate
23{
24 Q_OBJECT
25public:
30 ProfileTreeEditDelegate(QWidget *parent = Q_NULLPTR);
31
39 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
40
46 virtual void setEditorData(QWidget *editor, const QModelIndex &index) const override;
47
48private:
49 QWidget *editor_;
50 QModelIndex index_;
51};
52
53
58class ProfileTreeView : public QTreeView
59{
60 Q_OBJECT
61public:
66 ProfileTreeView(QWidget *parent = nullptr);
67
72
77 void selectRow(int row);
78
83 bool activeEdit();
84
85signals:
90
91protected:
95 virtual void showEvent(QShowEvent *) override;
96
102 virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
103
104protected slots:
111 virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
112
113private:
114 ProfileTreeEditDelegate *delegate_;
115};
116
117#endif
Item delegate that provides inline editing for profile name cells in the profile tree view.
Definition profile_tree_view.h:23
ProfileTreeEditDelegate(QWidget *parent=Q_NULLPTR)
Constructs a ProfileTreeEditDelegate.
Definition profile_tree_view.cpp:21
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Creates and returns an editor widget for the cell at index.
Definition profile_tree_view.cpp:23
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const override
Populates the editor widget with the current value from the model.
Definition profile_tree_view.cpp:32
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override
Responds to selection changes, updating UI state and emitting itemUpdated() when appropriate.
Definition profile_tree_view.cpp:56
~ProfileTreeView()
Destroys the view and releases the associated delegate.
Definition profile_tree_view.cpp:51
virtual void showEvent(QShowEvent *) override
Restores the previously selected row when the view becomes visible.
Definition profile_tree_view.cpp:107
void itemUpdated()
Emitted when a profile item has been modified through the inline editor.
void selectRow(int row)
Selects the row at row in the view, scrolling it into view if necessary.
Definition profile_tree_view.cpp:80
bool activeEdit()
Returns whether an inline edit is currently active in the view.
Definition profile_tree_view.cpp:100
ProfileTreeView(QWidget *parent=nullptr)
Constructs a ProfileTreeView.
Definition profile_tree_view.cpp:41
virtual void mouseDoubleClickEvent(QMouseEvent *event) override
Opens an inline editor for the double-clicked cell when the profile is editable; otherwise propagates...
Definition profile_tree_view.cpp:93