forked from qt-creator/qt-creator
QmlDesigner: Set QQuickItem parent if item is written to a property
The QQuickEngine does the same. Before in cases like this: Item { Slider { handle: Item { } } } The item parent of the handle was the root item instead of the slider. Change-Id: Ia022c82c6d85c2a957763c56639ac77bca9297e6 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
33e5ff9ecf
commit
034f1728ea
@@ -336,6 +336,10 @@ void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, c
|
||||
list.append(object);
|
||||
} else if (isObject(property)) {
|
||||
property.write(objectToVariant(object));
|
||||
|
||||
if (QQuickItem *item = qobject_cast<QQuickItem *>(object))
|
||||
if (QQuickItem *newParentItem = qobject_cast<QQuickItem *>(newParent))
|
||||
item->setParentItem(newParentItem);
|
||||
}
|
||||
|
||||
Q_ASSERT(objectToVariant(object).isValid());
|
||||
|
Reference in New Issue
Block a user