only select nodes on right click if the current clicked node isn't already selected

This commit is contained in:
itsmattkc
2021-01-22 17:12:04 +11:00
parent 3ce29f9093
commit b114bf98c9
+11 -8
View File
@@ -347,15 +347,18 @@ void NodeView::mousePressEvent(QMouseEvent *event)
if (HandPress(event)) return;
if (event->button() == Qt::RightButton) {
// Qt doesn't do this by default for some reason
if (!(event->modifiers() & Qt::ShiftModifier)) {
scene_.clearSelection();
}
// If there's an item here, select it
QGraphicsItem* item = itemAt(event->pos());
if (item) {
item->setSelected(true);
if (!item || !item->isSelected()) {
// Qt doesn't do this by default for some reason
if (!(event->modifiers() & Qt::ShiftModifier)) {
scene_.clearSelection();
}
// If there's an item here, select it
if (item) {
item->setSelected(true);
}
}
}