aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-04 15:46:48 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-05 19:48:26 +0100
commit37019a96db01b99a76b67b9e655bc457e8edb5a1 (patch)
treea8979cda9124b77ad28211750612e2b31f4ad344 /src/qml/qml/qqmlobjectcreator.cpp
parent1845ae01929cdaf6aa50ae096fe5c249f14b1f18 (diff)
[new compiler] Fix propagation of imported scripts for anonymous components
We must take the imported scripts from the creation context. Fixes various errors in Qt Quick Controls. Change-Id: I336d8ffa0537cefd4eeac15f98bbf1b0a5c784af Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index e2f1212e84..933242ba72 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -80,13 +80,14 @@ static void removeBindingOnProperty(QObject *o, int index)
if (binding) binding->destroy();
}
-QmlObjectCreator::QmlObjectCreator(QQmlContextData *parentContext, QQmlCompiledData *compiledData, QQmlContextData *rootContext)
+QmlObjectCreator::QmlObjectCreator(QQmlContextData *parentContext, QQmlCompiledData *compiledData, QQmlContextData *creationContext, QQmlContextData *rootContext)
: componentAttached(0)
, url(compiledData->url)
, engine(parentContext->engine)
, qmlUnit(compiledData->qmlUnit)
, jsUnit(compiledData->compilationUnit)
, parentContext(parentContext)
+ , creationContext(creationContext)
, context(0)
, resolvedTypes(compiledData->resolvedTypes)
, propertyCaches(compiledData->propertyCaches)
@@ -153,8 +154,8 @@ QObject *QmlObjectCreator::create(int subComponentIndex, QObject *parent)
QQmlScriptData *s = compiledData->scripts.at(i);
scripts->putIndexed(i, s->scriptValueForContext(context));
}
- } else if (parentContext) {
- context->importedScripts = parentContext->importedScripts;
+ } else if (creationContext) {
+ context->importedScripts = creationContext->importedScripts;
}
QVector<QQmlParserStatus*> parserStatusCallbacks;
@@ -942,7 +943,7 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent)
recordError(obj->location, tr("Composite Singleton Type %1 is not creatable").arg(stringAt(obj->inheritedTypeNameIndex)));
return 0;
}
- QmlObjectCreator subCreator(context, typeRef->component, rootContext);
+ QmlObjectCreator subCreator(context, typeRef->component, creationContext, rootContext);
instance = subCreator.create();
if (!instance) {
errors += subCreator.errors;