Sketcher: Element Task : clear selection when list selection is cleared

This commit is contained in:
PaddleStroke
2025-10-09 14:00:23 +02:00
committed by Chris Hennes
parent 084003e361
commit 98d64f9939
2 changed files with 14 additions and 0 deletions

View File

@@ -830,6 +830,19 @@ void ElementView::contextMenuEvent(QContextMenuEvent* event)
menu.exec(event->globalPos());
}
void ElementView::mousePressEvent(QMouseEvent* event)
{
// If the click is on an empty area (not on an item), it should
// clear the global selection.
if (!itemAt(event->pos())) {
Gui::Selection().clearSelection();
}
// Always call the base class implementation to ensure normal behavior
// like item clicks and the widget's own selection management continues to work.
QListWidget::mousePressEvent(event);
}
CONTEXT_MEMBER_DEF("Sketcher_ConstrainCoincident", doPointCoincidence)
CONTEXT_MEMBER_DEF("Sketcher_ConstrainPointOnObject", doPointOnObjectConstraint)
CONTEXT_MEMBER_DEF("Sketcher_ConstrainHorizontal", doHorizontalConstraint)

View File

@@ -68,6 +68,7 @@ public:
protected:
void contextMenuEvent(QContextMenuEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
protected Q_SLOTS:
// Constraints