forked from qt-creator/qt-creator
QmlDesigner: Fix flow editors decision items selection area
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 <henning.gruendl@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -2015,6 +2015,7 @@ void FormEditorFlowDecisionItem::updateGeometry()
|
|||||||
size = qmlItemNode().modelNode().auxiliaryData("blockSize").toInt();
|
size = qmlItemNode().modelNode().auxiliaryData("blockSize").toInt();
|
||||||
|
|
||||||
QRectF boundingRect(0, 0, size, size);
|
QRectF boundingRect(0, 0, size, size);
|
||||||
|
QRectF selectionRect = boundingRect;
|
||||||
QTransform transform;
|
QTransform transform;
|
||||||
if (qmlItemNode().isFlowDecision()) {
|
if (qmlItemNode().isFlowDecision()) {
|
||||||
transform.translate(boundingRect.center().x(), boundingRect.center().y());
|
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);
|
boundingRect = transform.mapRect(boundingRect);
|
||||||
|
selectionRect = boundingRect;
|
||||||
boundingRect = boundingRect.united(labelBoundingRect);
|
boundingRect = boundingRect.united(labelBoundingRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_selectionBoundingRect = boundingRect;
|
m_selectionBoundingRect = selectionRect;
|
||||||
m_paintedBoundingRect = m_selectionBoundingRect;
|
m_boundingRect = boundingRect;
|
||||||
m_boundingRect = m_paintedBoundingRect;
|
m_paintedBoundingRect = boundingRect;
|
||||||
setTransform(qmlItemNode().instanceTransformWithContentTransform());
|
setTransform(qmlItemNode().instanceTransformWithContentTransform());
|
||||||
const QPointF pos = qmlItemNode().flowPosition();
|
const QPointF pos = qmlItemNode().flowPosition();
|
||||||
setTransform(QTransform::fromTranslate(pos.x(), pos.y()));
|
setTransform(QTransform::fromTranslate(pos.x(), pos.y()));
|
||||||
|
Reference in New Issue
Block a user