forked from qt-creator/qt-creator
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:
@@ -872,6 +872,10 @@ void QuickItemNodeInstance::setPropertyVariant(const PropertyName &name, const Q
|
|||||||
|
|
||||||
void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression)
|
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))
|
if (ignoredProperties().contains(name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -883,7 +887,15 @@ void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const Q
|
|||||||
|
|
||||||
markRepeaterParentDirty();
|
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();
|
refresh();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user