diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2022-09-23 16:17:28 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2022-09-23 14:53:48 +0000 |
commit | 85b911d30b9eb5e3ad4ce21f0773a27057d57b21 (patch) | |
tree | a106d06d1687d3f4d03a175a53d71b29e3c46233 | |
parent | 507b1fff39bf47b794ad766cef78ed04f4f4ad0e (diff) | |
download | qt-creator-85b911d30b9eb5e3ad4ce21f0773a27057d57b21.tar.gz |
QmlDesigner: Fix anchor targets
In some cases the binding for anchor targets is not properly resolved.
Using explicitly the root context we define the ids in does solve
the issue.
Change-Id: I69e5bd237668719ec9417d30d0bac8635c79506a
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp index 5b1f3171ad..549db1b789 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp @@ -872,6 +872,10 @@ void QuickItemNodeInstance::setPropertyVariant(const PropertyName &name, const Q void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { + static QList<PropertyName> anchorsTargets = {"anchors.top", + "acnhors.bottom", + "anchors.left", + "achors.right"}; if (ignoredProperties().contains(name)) return; @@ -883,7 +887,15 @@ void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const Q markRepeaterParentDirty(); - ObjectNodeInstance::setPropertyBinding(name, expression); + if (anchorsTargets.contains(name)) { + //When resolving anchor targets we have to provide the root context the ids are defined in. + QmlPrivateGate::setPropertyBinding(object(), + context()->engine()->rootContext(), + name, + expression); + } else { + ObjectNodeInstance::setPropertyBinding(name, expression); + } refresh(); |