forked from qt-creator/qt-creator
Set the rootObject of a file component as the parent of the context of
the file component Reviewed-by: kkoehne
This commit is contained in:
@@ -176,7 +176,9 @@ QObject *NodeMetaInfo::createInstance(QDeclarativeContext *context) const
|
|||||||
// qml component
|
// qml component
|
||||||
// TODO: This is maybe expensive ...
|
// TODO: This is maybe expensive ...
|
||||||
QDeclarativeComponent component(context->engine(), QUrl::fromLocalFile(m_data->qmlFile));
|
QDeclarativeComponent component(context->engine(), QUrl::fromLocalFile(m_data->qmlFile));
|
||||||
object = component.create(new QDeclarativeContext(context));
|
QDeclarativeContext *newContext = new QDeclarativeContext(context);
|
||||||
|
object = component.create(newContext);
|
||||||
|
newContext->setParent(object);
|
||||||
} else {
|
} else {
|
||||||
// primitive
|
// primitive
|
||||||
object = QDeclarativeMetaType::qmlType(typeName().toAscii(), minorVersion(), majorVersion())->create();
|
object = QDeclarativeMetaType::qmlType(typeName().toAscii(), minorVersion(), majorVersion())->create();
|
||||||
|
|||||||
Reference in New Issue
Block a user