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:
Thomas Hartmann
2013-04-30 12:40:01 +02:00
committed by Marco Bubke
parent b89ca41d97
commit 9763e9e325

View File

@@ -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());
} }