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>
This commit is contained in:
Thomas Hartmann
2022-09-23 16:17:28 +02:00
parent 507b1fff39
commit 85b911d30b

View File

@@ -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();
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();