aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmlcontext.cpp')
-rw-r--r--src/qml/qml/qqmlcontext.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index 3e6ca6667e..f08f650913 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -760,10 +760,10 @@ void QQmlContextData::setIdProperty(int idx, QObject *obj)
idValues[idx].context = this;
}
-void QQmlContextData::setIdPropertyData(const QVector<ObjectIdMapping> &data)
+void QQmlContextData::setIdPropertyData(const QHash<int, int> &data)
{
- Q_ASSERT(idObjectNames.isEmpty());
- idObjectNames = data;
+ Q_ASSERT(objectIndexToId.isEmpty());
+ objectIndexToId = data;
Q_ASSERT(propertyNameCache.isEmpty());
idValueCount = data.count();
idValues = new ContextGuard[idValueCount];
@@ -808,10 +808,13 @@ QV4::IdentifierHash<int> &QQmlContextData::propertyNames() const
{
if (propertyNameCache.isEmpty()) {
propertyNameCache = QV4::IdentifierHash<int>(QV8Engine::getV4(engine->handle()));
- for (QVector<ObjectIdMapping>::ConstIterator it = idObjectNames.begin(), end = idObjectNames.end();
- it != end; ++it)
- propertyNameCache.add(it->name, it->id);
- idObjectNames.clear();
+ for (QHash<int, int>::ConstIterator it = objectIndexToId.begin(), end = objectIndexToId.end();
+ it != end; ++it) {
+ const QV4::CompiledData::Object *obj = typeCompilationUnit->data->objectAt(it.key());
+ const QString name = typeCompilationUnit->data->stringAt(obj->idIndex);
+ propertyNameCache.add(name, it.value());
+ }
+ objectIndexToId.clear();
}
return propertyNameCache;
}