Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
profile_tree_view.h
Go to the documentation of this file.
1
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;
40
46 virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
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 *);
96
102 virtual void mouseDoubleClickEvent(QMouseEvent *event);
103
104protected slots:
111 virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
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
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
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
Populates the editor widget with the current value from the model.
Definition profile_tree_view.cpp:32
Tree view specialised for displaying and editing configuration profiles, with inline editing support ...
Definition profile_tree_view.h:59
virtual void mouseDoubleClickEvent(QMouseEvent *event)
Opens an inline editor for the double-clicked cell when the profile is editable; otherwise propagates...
Definition profile_tree_view.cpp:93
~ProfileTreeView()
Destroys the view and releases the associated delegate.
Definition profile_tree_view.cpp:51
void itemUpdated()
Emitted when a profile item has been modified through the inline editor.
virtual void showEvent(QShowEvent *)
Restores the previously selected row when the view becomes visible.
Definition profile_tree_view.cpp:107
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Responds to selection changes, updating UI state and emitting itemUpdated() when appropriate.
Definition profile_tree_view.cpp:56
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