summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcompiler.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-04-27 05:36:11 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-04-27 05:36:11 (GMT)
commit9f941fd65083ae6d3f2f5441bf60346821932218 (patch)
tree4ccd25dd9de4835a551534de37a931e2105fa4d3 /src/declarative/qml/qmlcompiler.cpp
parentf75b524b060682a896ac7a3951ac677d29e15727 (diff)
downloadQt-9f941fd65083ae6d3f2f5441bf60346821932218.zip
Qt-9f941fd65083ae6d3f2f5441bf60346821932218.tar.gz
Qt-9f941fd65083ae6d3f2f5441bf60346821932218.tar.bz2
Add a declarative data ptr to QObjectPrivate
This data ptr does not increase the size of the QObject, as we take advantage of space only used during destruction. Currently this data is only used to store an object's QmlContext, but it will be used for more later.
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;
}