forked from qt-creator/qt-creator
QmlDesigner.Instances: always set the QObject parent.
We follow the QmlEngine/VME and always set the QObject parent before reparenting into list properties. Also we set the QObject parent for all objects. See qqmlvme.cpp line 622 QQml_setParent_noEvent(o, parent); Change-Id: If889e6cc07e99ea443b80de13c4be9dce6c2ceee Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
committed by
Marco Bubke
parent
b89ca41d97
commit
9763e9e325
@@ -376,6 +376,9 @@ void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, c
|
|||||||
{
|
{
|
||||||
QQmlProperty property(newParent, newParentProperty, context());
|
QQmlProperty property(newParent, newParentProperty, context());
|
||||||
|
|
||||||
|
if (object)
|
||||||
|
object->setParent(newParent);
|
||||||
|
|
||||||
if (isList(property)) {
|
if (isList(property)) {
|
||||||
QQmlListReference list = qvariant_cast<QQmlListReference>(property.read());
|
QQmlListReference list = qvariant_cast<QQmlListReference>(property.read());
|
||||||
|
|
||||||
@@ -389,11 +392,6 @@ void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, c
|
|||||||
property.write(objectToVariant(object));
|
property.write(objectToVariant(object));
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickItem *quickItem = qobject_cast<QQuickItem*>(object);
|
|
||||||
|
|
||||||
if (object && !(quickItem && quickItem->parentItem()))
|
|
||||||
object->setParent(newParent);
|
|
||||||
|
|
||||||
Q_ASSERT(objectToVariant(object).isValid());
|
Q_ASSERT(objectToVariant(object).isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user