summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcompiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index f03ce20..5436227 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -1647,12 +1647,15 @@ QmlCompiledData &QmlCompiledData::operator=(const QmlCompiledData &other)
return *this;
}
-QObject *QmlCompiledData::TypeReference::createInstance() const
+QObject *QmlCompiledData::TypeReference::createInstance(QmlContext *ctxt) const
{
if(type) {
- return type->create();
+ QObject *rv = type->create();
+ if(rv)
+ QmlEngine::setContextForObject(rv, ctxt);
+ return rv;
} else if(component) {
- return component->create(QmlContext::activeContext());
+ return component->create(ctxt);
} else {
return 0;
}