TechDraw: Fix double drag in projection groups

This commit is contained in:
Ryan Kembrey
2025-09-23 13:45:11 +10:00
committed by Chris Hennes
parent d092a94902
commit e9ce06155d

View File

@@ -72,8 +72,14 @@ bool QGIProjGroup::sceneEventFilter(QGraphicsItem* watched, QEvent *event)
auto *mEvent = dynamic_cast<QGraphicsSceneMouseEvent*>(event);
// Disable moves on the view to prevent double drag
bool initCanMove = qWatched->flags() & QGraphicsItem::ItemIsMovable;
qWatched->setFlag(QGraphicsItem::ItemIsMovable, false);
std::vector<QGraphicsItem*> modifiedChildren;
for (auto* child : childItems()) {
if (child->isSelected() && (child->flags() & QGraphicsItem::ItemIsMovable)) {
child->setFlag(QGraphicsItem::ItemIsMovable, false);
modifiedChildren.push_back(child);
}
}
switch (event->type()) {
case QEvent::GraphicsSceneMousePress:
mousePressEvent(mEvent);
@@ -87,8 +93,9 @@ bool QGIProjGroup::sceneEventFilter(QGraphicsItem* watched, QEvent *event)
default:
break;
}
// Restore flag
qWatched->setFlag(QGraphicsItem::ItemIsMovable, initCanMove);
for (auto* child : modifiedChildren) {
child->setFlag(QGraphicsItem::ItemIsMovable, true);
}
return true;
}
}