From bc7f52c475eed7c5c9e4974c0c0cb4d02b754ce9 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 1 Oct 2021 17:00:17 +0200 Subject: [PATCH] QmlDesigner: Remove x,y when setting center anchors Change-Id: Id6cde717f8a6fe66ac78c65e2e1ac387ec6d3c1d Reviewed-by: Aleksei German Reviewed-by: Qt CI Bot --- .../components/propertyeditor/qmlanchorbindingproxy.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp index aecab7c42ce..2664f2c7a90 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp @@ -861,6 +861,7 @@ void QmlAnchorBindingProxy::anchorVertical() m_qmlItemNode.anchors().setAnchor(AnchorLineVerticalCenter, m_verticalTarget, AnchorLineVerticalCenter); } + backupPropertyAndRemove(modelNode(), "y"); m_locked = false; } @@ -874,6 +875,7 @@ void QmlAnchorBindingProxy::anchorHorizontal() } else if (m_relativeVerticalTarget == Center) { m_qmlItemNode.anchors().setAnchor(AnchorLineHorizontalCenter, m_horizontalTarget, AnchorLineHorizontalCenter); } + backupPropertyAndRemove(modelNode(), "x"); m_locked = false; } @@ -993,6 +995,7 @@ void QmlAnchorBindingProxy::setVerticalCentered(bool centered) if (!centered) { m_qmlItemNode.anchors().removeAnchor(AnchorLineVerticalCenter); m_qmlItemNode.anchors().removeMargin(AnchorLineVerticalCenter); + restoreProperty(m_qmlItemNode, "y"); } else { m_relativeVerticalTarget = Center; @@ -1020,6 +1023,7 @@ void QmlAnchorBindingProxy::setHorizontalCentered(bool centered) if (!centered) { m_qmlItemNode.anchors().removeAnchor(AnchorLineHorizontalCenter); m_qmlItemNode.anchors().removeMargin(AnchorLineHorizontalCenter); + restoreProperty(m_qmlItemNode, "x"); } else { m_relativeHorizontalTarget = Center;