forked from qt-creator/qt-creator
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: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
committed by
Tim Jenssen
parent
72af6b7834
commit
c7a6221e6e
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user