aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcomponent.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-09-12 16:53:32 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 14:26:05 +0200
commit3ec5aae38e77d370d1a23efe4b924ee4762a2238 (patch)
treebff7f62c5daa35a2e045d87a0ea882d211d05c4e /src/qml/qml/qqmlcomponent.cpp
parent6042327dee1f8dd912a86be16f4044d259c9b3e4 (diff)
[new compiler] Add support for id properties
Change-Id: Idb4a0ad06f6cbe5d040da075a8f43d067a27ebc4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlcomponent.cpp')
-rw-r--r--src/qml/qml/qqmlcomponent.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 955c940a9d..2063c5bb25 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -900,8 +900,21 @@ QQmlComponentPrivate::beginCreate(QQmlContextData *context)
if (cc->compilationUnit && !cc->compilationUnit->engine)
cc->compilationUnit->linkToEngine(v4);
+ // ### sub-contexts
+ QVector<QQmlContextData::ObjectIdMapping> mapping(cc->objectIndexToId.count());
+ for (QHash<int, int>::ConstIterator it = cc->objectIndexToId.constBegin(), end = cc->objectIndexToId.constEnd();
+ it != end; ++it) {
+ const QV4::CompiledData::Object *obj = cc->qmlUnit->objectAt(it.key());
+
+ QQmlContextData::ObjectIdMapping m;
+ m.id = it.value();
+ m.name = cc->qmlUnit->header.stringAt(obj->idIndex);
+ mapping[m.id] = m;
+ }
+ context->setIdPropertyData(mapping);
+
state.creator = new QmlObjectCreator(context, cc->qmlUnit, cc->compilationUnit, cc->resolvedTypes,
- cc->propertyCaches, cc->datas);
+ cc->propertyCaches, cc->datas, cc->objectIndexToId);
rv = state.creator->create();
if (!rv)
state.errors = state.creator->errors;