Krita Source Code Documentation
Loading...
Searching...
No Matches
NodeView.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2006 Gábor Lehel <illissius@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KIS_DOCUMENT_SECTION_VIEW_H
8#define KIS_DOCUMENT_SECTION_VIEW_H
9
10#include <QTreeView>
11#include <QScroller>
12#include <optional>
13
14#include "kritalayerdocker_export.h"
15
16class QStyleOptionViewItem;
17class KisNodeModel;
18
29class KRITALAYERDOCKER_EXPORT NodeView : public QTreeView
30{
31 Q_OBJECT
32Q_SIGNALS:
38 void contextMenuRequested(const QPoint &globalPos, const QModelIndex &index);
40public:
41
43 DEFAULT_COL = 0,
44 VISIBILITY_COL = 1,
45 SELECTED_COL = 2,
46 };
47
51 explicit NodeView(QWidget *parent = 0);
52 ~NodeView() override;
53
54 void setModel(QAbstractItemModel *model) override;
55 void resizeEvent(QResizeEvent * event) override;
56 void paintEvent (QPaintEvent *event) override;
57 void drawBranches(QPainter *painter, const QRect &rect,
58 const QModelIndex &index) const override;
59
60 void dropEvent(QDropEvent *ev) override;
61
62 void dragEnterEvent(QDragEnterEvent *e) override;
63
64 void dragMoveEvent(QDragMoveEvent *ev) override;
65
66 void dragLeaveEvent(QDragLeaveEvent *e) override;
67 void mousePressEvent(QMouseEvent *e) override;
68
96 void addPropertyActions(QMenu *menu, const QModelIndex &index);
97
98 void updateNode(const QModelIndex &index);
99
100 void toggleSolo(const QModelIndex &index);
101
102protected:
103 QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index, const QEvent *event) const override;
104 QModelIndex indexAt(const QPoint &point) const override;
105 bool viewportEvent(QEvent *event) override;
106 void contextMenuEvent(QContextMenuEvent *event) override;
107 virtual void showContextMenu(const QPoint &globalPos, const QModelIndex &index);
108 void startDrag (Qt::DropActions supportedActions) override;
109 QPixmap createDragPixmap() const;
110
114 int cursorPageIndex() const;
115
116public Q_SLOTS:
118 void slotUpdateIcons();
119 void slotScrollerStateChanged(QScroller::State state);
120 void slotConfigurationChanged();
121
122protected Q_SLOTS:
123 void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
124 void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override;
125 void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
126
127private Q_SLOTS:
128 void slotActionToggled(bool on, const QPersistentModelIndex &index, int property);
129
130private:
131
137 bool isDragging() const;
138
144 void setDraggingFlag(bool flag = true);
145
146 void updateSelectedCheckboxColumn();
147
148 std::optional<QModelIndex> getActiveItem();
149 void setExclusiveActiveItem(QModelIndex index);
150
152
153 QStyleOptionViewItem optionForIndex(const QModelIndex &index) const;
155 class PropertyAction;
156 class Private;
157 Private* const d;
158};
159
160#endif
void contextMenuRequested(const QPoint &globalPos, const QModelIndex &index)
Private *const d
Definition NodeView.h:157
KisNodeModel Model
Definition NodeView.h:154
void selectionChanged(const QModelIndexList &)
bool m_draggingFlag
Definition NodeView.h:151