Commit c7a6221e authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Tim Jenssen

QmlDesigner: Evaluate properties for the root item in dummy context

We evaluate properties for the root item in dummy context if
they contain "parent.".

Defining a parent in the dummy context was not working for QML 2,
because there seems to be a shortcut bypassing the metasystem for parent.

Task-number: QTCREATORBUG-15530
Change-Id: I710f1ef36b8c97cc481b9909a775f06d9e03f666
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent 72af6b78
......@@ -644,6 +644,16 @@ void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const Q
refresh();
/* Evaluate properties of the root item in the context of the dummy context if they contain parent.
* This is done manually because we cannot "overwrite" the parent property
*/
if (isRootNodeInstance() && expression.contains(QLatin1String("parent."))) {
QQmlExpression qmlContextExpression(context(), nodeInstanceServer()->dummyContextObject(), expression);
QVariant value = qmlContextExpression.evaluate();
setPropertyVariant(name, value);
}
if (isInLayoutable())
parentInstance()->refreshLayoutable();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment