diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-08-26 09:43:33 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-08-26 09:51:56 +0200 |
commit | e9e6f70d355499d551a26960d236644f92ea38af (patch) | |
tree | 542840d4b3b8ff82d6fab38c9ad2615d3592b793 /src/qml/qml/qqmlobjectcreator.cpp | |
parent | 916ced089f37d96ca8ef1cdb938791247bd44b72 (diff) | |
parent | eadc35f499edd25d5d1c5f803db1d61675c1cc2c (diff) |
Merge remote-tracking branch 'origin/5.3' into 5.4
Conflicts:
src/qml/qml/qqmlobjectcreator_p.h
Change-Id: I60858ddb46866a8fa1a8576bb05b412afeeb4e41
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 4efe72d862..0ad60e01ab 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -1021,6 +1021,13 @@ void QQmlObjectCreator::recordError(const QV4::CompiledData::Location &location, errors << error; } +void QQmlObjectCreator::registerObjectWithContextById(int objectIndex, QObject *instance) const +{ + QHash<int, int>::ConstIterator idEntry = objectIndexToId.find(objectIndex); + if (idEntry != objectIndexToId.constEnd()) + context->setIdProperty(idEntry.value(), instance); +} + QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isContextObject) { QQmlObjectCreationProfiler profiler(sharedState->profiler.profiler); @@ -1120,10 +1127,6 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo parserStatus->d = &sharedState->allParserStatusCallbacks.top(); } - QHash<int, int>::ConstIterator idEntry = objectIndexToId.find(index); - if (idEntry != objectIndexToId.constEnd()) - context->setIdProperty(idEntry.value(), instance); - // Register the context object in the context early on in order for pending binding // initialization to find it available. if (isContextObject) @@ -1147,8 +1150,10 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo } } - if (isComponent) + if (isComponent) { + registerObjectWithContextById(index, instance); return instance; + } QQmlRefPointer<QQmlPropertyCache> cache = propertyCaches.at(index); Q_ASSERT(!cache.isNull()); @@ -1313,6 +1318,9 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject * } else { vmeMetaObject = QQmlVMEMetaObject::get(_qobject); } + + registerObjectWithContextById(index, _qobject); + qSwap(_propertyCache, cache); qSwap(_vmeMetaObject, vmeMetaObject); |