Commit bdeb9371 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.Instances: The engine does set the QObject parent first

We should follow the engine and set the QObject parent first.
Actually some items (e.g. menus) do not like it differently.

A note: The engine seems to always set the QObject parent even for items.

Change-Id: I700e8802300b8eee093f73ea11e07c4cdb0338aa
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 7a5836d2
......@@ -378,6 +378,12 @@ void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, c
{
QQmlProperty property(newParent, newParentProperty, context());
QQuickItem *quickItem = qobject_cast<QQuickItem*>(object);
//The engine sets the QObject before it does reparent
if (object && !quickItem)
object->setParent(newParent);
if (isList(property)) {
QQmlListReference list = qvariant_cast<QQmlListReference>(property.read());
......@@ -391,8 +397,6 @@ void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, c
property.write(objectToVariant(object));
}
QQuickItem *quickItem = qobject_cast<QQuickItem*>(object);
if (object && !(quickItem && quickItem->parentItem()))
object->setParent(newParent);
......
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