From dab168fa81b615dc0ac9b60fa76c224660556d81 Mon Sep 17 00:00:00 2001 From: Tuomo Pelkonen Date: Tue, 23 Feb 2021 12:20:22 +0200 Subject: [PATCH] QmlDesigner: Fix flow editors decision items selection area MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Decision item must only be selectable from the item, not the label text. Text can overlap with other items and selection becomes unnatural if it is included in selection bounding rectangle. Task-number: QDS-3747 Change-Id: Ic5697f124cd0210f6af00b3c004ea19d0af2cd91 Reviewed-by: Henning Gründl Reviewed-by: Thomas Hartmann --- .../components/formeditor/formeditoritem.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp index 2c388bb6d9c..ac9fbab89e3 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp @@ -2015,6 +2015,7 @@ void FormEditorFlowDecisionItem::updateGeometry() size = qmlItemNode().modelNode().auxiliaryData("blockSize").toInt(); QRectF boundingRect(0, 0, size, size); + QRectF selectionRect = boundingRect; QTransform transform; if (qmlItemNode().isFlowDecision()) { transform.translate(boundingRect.center().x(), boundingRect.center().y()); @@ -2073,14 +2074,15 @@ void FormEditorFlowDecisionItem::updateGeometry() } } - // Unite the rotate item bounding rect with the label bounding rect. + // bounding rect is combination of label and icon but only icon can be clicked boundingRect = transform.mapRect(boundingRect); + selectionRect = boundingRect; boundingRect = boundingRect.united(labelBoundingRect); } - m_selectionBoundingRect = boundingRect; - m_paintedBoundingRect = m_selectionBoundingRect; - m_boundingRect = m_paintedBoundingRect; + m_selectionBoundingRect = selectionRect; + m_boundingRect = boundingRect; + m_paintedBoundingRect = boundingRect; setTransform(qmlItemNode().instanceTransformWithContentTransform()); const QPointF pos = qmlItemNode().flowPosition(); setTransform(QTransform::fromTranslate(pos.x(), pos.y()));