10#ifndef PROFILE_TREEVIEW_H
11#define PROFILE_TREEVIEW_H
16#include <QItemDelegate>
17#include <QPersistentModelIndex>
42 QWidget *
createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
49 virtual void setEditorData(QWidget *editor,
const QModelIndex &index)
const override;
98 virtual void showEvent(QShowEvent *)
override;
111 virtual void startDrag(Qt::DropActions supportedActions)
override;
118 virtual void dragLeaveEvent(QDragLeaveEvent *event)
override;
119 virtual void dropEvent(QDropEvent *event)
override;
120 virtual void drawRow(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
121 virtual void paintEvent(QPaintEvent *event)
override;
130 virtual void selectionChanged(
const QItemSelection &selected,
const QItemSelection &deselected)
override;
134 QList<QPersistentModelIndex> drop_path_;
135 QPixmap drag_pixmap_;
137 QPoint drag_pos_ = QPoint(-1, -1);
138 bool drop_top_level_ =
false;
145 void setDropPath(
const QModelIndex &target,
bool topLevel =
false);
Item delegate that provides inline editing for profile name cells in the profile tree view.
Definition profile_tree_view.h:26
ProfileTreeEditDelegate(QWidget *parent=Q_NULLPTR)
Constructs a ProfileTreeEditDelegate.
Definition profile_tree_view.cpp:28
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:30
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:39
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:63
~ProfileTreeView()
Destroys the view and releases the associated delegate.
Definition profile_tree_view.cpp:58
virtual void dragMoveEvent(QDragMoveEvent *event) override
Highlights the profile where a dragged profile will be moved to, and all its parents.
Definition profile_tree_view.cpp:181
virtual void showEvent(QShowEvent *) override
Restores the previously selected row when the view becomes visible.
Definition profile_tree_view.cpp:260
virtual void startDrag(Qt::DropActions supportedActions) override
Starts dragging the selected profile names, with the same drag image on all platforms.
Definition profile_tree_view.cpp:118
void itemUpdated()
Emitted when a profile item has been modified through the inline editor.
void selectIndex(const QModelIndex &idx)
Selects the row of idx in the view.
Definition profile_tree_view.cpp:87
bool activeEdit()
Returns whether an inline edit is currently active in the view.
Definition profile_tree_view.cpp:253
ProfileTreeView(QWidget *parent=nullptr)
Constructs a ProfileTreeView.
Definition profile_tree_view.cpp:48
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:100