Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Make layer selection and dnd behave more consistently
Luna Lovecraft6813bb94a37c
diff --git a/plugins/dockers/layerdocker/NodeDelegate.cpp b/plugins/dockers/layerdocker/NodeDelegate.cppindex d333e9036d..146a706fd6 100644--- a/plugins/dockers/layerdocker/NodeDelegate.cpp+++ b/plugins/dockers/layerdocker/NodeDelegate.cpp@@ -1126,11 +1126,6 @@ bool NodeDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const Qd->view->setCurrentIndex(index);model->setData(index, true, KisNodeModel::AlternateActiveRole);- return true;- } else if (mouseEvent->modifiers() == Qt::ControlModifier) {- // the control modifier shifts the current index as well (even when deselected), so we- // handle it manually.- changeSelectionAndCurrentIndex(index);return true;}return false;diff --git a/plugins/dockers/layerdocker/NodeView.cpp b/plugins/dockers/layerdocker/NodeView.cppindex c0e7a7e066..b3a6a889f2 100644--- a/plugins/dockers/layerdocker/NodeView.cpp+++ b/plugins/dockers/layerdocker/NodeView.cpp@@ -148,6 +148,20 @@ void NodeView::toggleSolo(const QModelIndex &index) {d->delegate.toggleSolo(index);}+QItemSelectionModel::SelectionFlags NodeView::selectionCommand(const QModelIndex &index, const QEvent *event) const+{+ //Block selection on press if ctrl is held+ //This is to allow for a more consistent behaviour with ctrl+dnd+ if (event &&+ event->type() == QEvent::MouseButtonPress ) {+ const QMouseEvent *mevent = static_cast<const QMouseEvent*>(event);+ if (mevent->modifiers() & Qt::ControlModifier)+ return QItemSelectionModel::NoUpdate;+ }++ return QTreeView::selectionCommand(index, event);+}+QModelIndex NodeView::indexAt(const QPoint &point) const{KisNodeViewColorScheme scm;diff --git a/plugins/dockers/layerdocker/NodeView.h b/plugins/dockers/layerdocker/NodeView.hindex a14ac79939..1ccd93ba30 100644--- a/plugins/dockers/layerdocker/NodeView.h+++ b/plugins/dockers/layerdocker/NodeView.h@@ -98,6 +98,7 @@ public:void toggleSolo(const QModelIndex &index);protected:+ QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index, const QEvent *event) const override;QModelIndex indexAt(const QPoint &point) const override;bool viewportEvent(QEvent *event) override;void contextMenuEvent(QContextMenuEvent *event) override;