|
Krita Source Code Documentation
|
#include <NodeView.h>
Inheritance diagram for NodeView:Classes | |
| class | PropertyAction |
Public Types | |
| enum | ColumnIndex { DEFAULT_COL = 0 , VISIBILITY_COL = 1 , SELECTED_COL = 2 } |
Public Slots | |
| void | slotConfigurationChanged () |
| void | slotScrollerStateChanged (QScroller::State state) |
| void | slotUpdateIcons () |
| called with a theme change to refresh icon colors | |
Signals | |
| void | contextMenuRequested (const QPoint &globalPos, const QModelIndex &index) |
| void | selectionChanged (const QModelIndexList &) |
Public Member Functions | |
| void | addPropertyActions (QMenu *menu, const QModelIndex &index) |
| void | dragEnterEvent (QDragEnterEvent *e) override |
| void | dragLeaveEvent (QDragLeaveEvent *e) override |
| void | dragMoveEvent (QDragMoveEvent *ev) override |
| void | drawBranches (QPainter *painter, const QRect &rect, const QModelIndex &index) const override |
| void | dropEvent (QDropEvent *ev) override |
| NodeView (QWidget *parent=0) | |
| void | paintEvent (QPaintEvent *event) override |
| Private (NodeView *_q) | |
| void | resizeEvent (QResizeEvent *event) override |
| void | setModel (QAbstractItemModel *model) override |
| void | toggleSolo (const QModelIndex &index) |
| void | updateNode (const QModelIndex &index) |
| ~NodeView () override | |
Public Attributes | |
| NodeDelegate | delegate |
| QPersistentModelIndex | hovered |
| QPoint | lastPos |
Protected Slots | |
| void | currentChanged (const QModelIndex ¤t, const QModelIndex &previous) override |
| void | dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >()) override |
| void | selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) override |
Protected Member Functions | |
| void | contextMenuEvent (QContextMenuEvent *event) override |
| QPixmap | createDragPixmap () const |
| int | cursorPageIndex () const |
| QModelIndex | indexAt (const QPoint &point) const override |
| QItemSelectionModel::SelectionFlags | selectionCommand (const QModelIndex &index, const QEvent *event) const override |
| virtual void | showContextMenu (const QPoint &globalPos, const QModelIndex &index) |
| void | startDrag (Qt::DropActions supportedActions) override |
| bool | viewportEvent (QEvent *event) override |
Private Types | |
| typedef KisNodeModel | Model |
Private Slots | |
| void | slotActionToggled (bool on, const QPersistentModelIndex &index, int property) |
Private Member Functions | |
| bool | isDragging () const |
| QStyleOptionViewItem | optionForIndex (const QModelIndex &index) const |
| void | setDraggingFlag (bool flag=true) |
| void | updateSelectedCheckboxColumn () |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Private Attributes | |
| Private *const | d |
| bool | m_draggingFlag |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
A widget displaying the Krita nodes (layers, masks, local selections, etc.)
This class is designed as a Qt model-view widget.
The Qt documentation explains the design and terminology for these classes: https://doc.qt.io/qt-5/model-view-programming.html
This widget should work correctly in your Qt designer .ui file.
Definition at line 50 of file NodeView.cpp.
|
private |
Definition at line 151 of file NodeView.h.
| Enumerator | |
|---|---|
| DEFAULT_COL | |
| VISIBILITY_COL | |
| SELECTED_COL | |
Definition at line 41 of file NodeView.h.
|
explicit |
Create a new NodeView.
Definition at line 70 of file NodeView.cpp.
References connect(), KisKineticScroller::createPreconfiguredScroller(), d, and slotScrollerStateChanged().
|
override |
| void NodeView::addPropertyActions | ( | QMenu * | menu, |
| const QModelIndex & | index ) |
Add toggle actions for all the properties associated with the current document section associated with the model index to the specified menu.
For instance, if a document section can be locked and visible, the menu will be expanded with locked and visible toggle actions.
For instance
| menu | A pointer to the menu that will be expanded with the toggle actions |
| index | The model index associated with the document section that may or may not provide a number of toggle actions. |
Definition at line 129 of file NodeView.cpp.
References connect(), KisNodeModel::PropertiesRole, and slotActionToggled().
|
overrideprotected |
Definition at line 291 of file NodeView.cpp.
References indexAt(), and showContextMenu().
|
signal |
Emitted whenever the user clicks with the secondary mouse button on an item. It is up to the application to design the contents of the context menu and show it.
|
protected |
Definition at line 367 of file NodeView.cpp.
References KisNodeModel::BeginThumbnailRole, KisIconUtils::SizeHuge, and KisIconUtils::SizeLarge.
|
overrideprotectedslot |
Definition at line 305 of file NodeView.cpp.
References KisNodeModel::ActiveRole.
|
protected |
Calculates the index of the nearest item to the cursor position
Definition at line 468 of file NodeView.cpp.
|
overrideprotectedslot |
Definition at line 315 of file NodeView.cpp.
References KisNodeModel::ActiveRole.
|
override |
Definition at line 490 of file NodeView.cpp.
References DRAG_WHILE_DRAG_WORKAROUND_START, and KisNodeModel::DropEnabled.
|
override |
Definition at line 507 of file NodeView.cpp.
References DRAG_WHILE_DRAG_WORKAROUND_STOP.
|
override |
Definition at line 501 of file NodeView.cpp.
References DRAG_WHILE_DRAG_WORKAROUND_START.
|
override |
Definition at line 448 of file NodeView.cpp.
References d.
|
override |
Definition at line 462 of file NodeView.cpp.
References DRAG_WHILE_DRAG_WORKAROUND_STOP.
|
overrideprotected |
Definition at line 206 of file NodeView.cpp.
|
private |
Permit to know if a slide is dragging
Definition at line 513 of file NodeView.cpp.
References m_draggingFlag.
|
private |
Definition at line 347 of file NodeView.cpp.
|
override |
Definition at line 442 of file NodeView.cpp.
|
inline |
Definition at line 53 of file NodeView.cpp.
|
override |
Definition at line 423 of file NodeView.cpp.
References DEFAULT_COL, KisNodeViewColorScheme::indentation(), SELECTED_COL, KisNodeViewColorScheme::selectedButtonColumnWidth(), VISIBILITY_COL, and KisNodeViewColorScheme::visibilityColumnWidth().
|
overrideprotectedslot |
Definition at line 333 of file NodeView.cpp.
References selectionChanged().
|
signal |
|
overrideprotected |
Qt has a bug: when we Ctrl+click on an item, the item's selections gets toggled on mouse press, whereas usually it is done on mouse release. Therefore the user cannot do a Ctrl+D&D with the default configuration. This code fixes the problem by manually returning QItemSelectionModel::NoUpdate flag when the user clicks on an item and returning QItemSelectionModel::Toggle on release.
Qt 5.6 has a bug: it reads global modifiers, not the ones passed from event. So if you paste an item using Ctrl+V it'll select multiple layers for you
Definition at line 151 of file NodeView.cpp.
|
private |
Setter for the dragging flag
| flag | boolean |
Definition at line 518 of file NodeView.cpp.
References m_draggingFlag.
|
override |
Definition at line 104 of file NodeView.cpp.
References KisNodeViewColorScheme::instance(), SELECTED_COL, KisConfig::useLayerSelectionCheckbox(), and VISIBILITY_COL.
|
protectedvirtual |
Definition at line 300 of file NodeView.cpp.
References contextMenuRequested().
|
privateslot |
Definition at line 340 of file NodeView.cpp.
References KisNodeModel::PropertiesRole.
|
slot |
Definition at line 532 of file NodeView.cpp.
References d, KisNodeViewColorScheme::instance(), and updateSelectedCheckboxColumn().
|
slot |
Definition at line 528 of file NodeView.cpp.
References KisKineticScroller::updateCursor().
|
slot |
called with a theme change to refresh icon colors
Definition at line 523 of file NodeView.cpp.
References d.
|
overrideprotected |
Definition at line 361 of file NodeView.cpp.
References DRAG_WHILE_DRAG_WORKAROUND_START.
| void NodeView::toggleSolo | ( | const QModelIndex & | index | ) |
Definition at line 147 of file NodeView.cpp.
References d.
| void NodeView::updateNode | ( | const QModelIndex & | index | ) |
Definition at line 142 of file NodeView.cpp.
References dataChanged().
|
private |
Definition at line 539 of file NodeView.cpp.
References DEFAULT_COL, SELECTED_COL, and KisConfig::useLayerSelectionCheckbox().
|
overrideprotected |
Definition at line 220 of file NodeView.cpp.
References buttons(), d, DRAG_WHILE_DRAG_WORKAROUND_STOP, hovered, indexAt(), and optionForIndex().
|
private |
Definition at line 154 of file NodeView.h.
| NodeDelegate NodeView::delegate |
Definition at line 60 of file NodeView.cpp.
| QPersistentModelIndex NodeView::hovered |
Definition at line 61 of file NodeView.cpp.
| QPoint NodeView::lastPos |
Definition at line 62 of file NodeView.cpp.
|
private |
Definition at line 148 of file NodeView.h.