diff options
author | Fawzi Mohamed <[email protected]> | 2014-07-16 16:21:40 +0200 |
---|---|---|
committer | Fawzi Mohamed <[email protected]> | 2014-07-17 12:14:33 +0200 |
commit | 176096d11291717cff356b6281821f23e3f39ba7 (patch) | |
tree | c0b984080076a44d07498c740b246ca4e00cc1d0 /src/libs/qmljs/qmljslink.cpp | |
parent | dae0d5afcdcaaa5c1f1d29d9dde590521b4b1e5e (diff) |
qmljs: track origin of ObjectValues
allows unique identification of types
Change-Id: Id4e6a9c1fa23409b1e2d5eb32708a0bacd04a5da
Reviewed-by: Tim Jenssen <[email protected]>
Reviewed-by: Fawzi Mohamed <[email protected]>
Diffstat (limited to 'src/libs/qmljs/qmljslink.cpp')
-rw-r--r-- | src/libs/qmljs/qmljslink.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 969bc8c939d..e0006e4b837 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -147,10 +147,14 @@ Link::Link(const Snapshot &snapshot, const ViewerContext &vContext, const Librar ModelManagerInterface *modelManager = ModelManagerInterface::instance(); if (modelManager) { ModelManagerInterface::CppDataHash cppDataHash = modelManager->cppData(); - - // populate engine with types from C++ - foreach (const ModelManagerInterface::CppData &cppData, cppDataHash) { - d->valueOwner->cppQmlTypes().load(cppData.exportedTypes); + { + // populate engine with types from C++ + ModelManagerInterface::CppDataHashIterator cppDataHashIterator(cppDataHash); + while (cppDataHashIterator.hasNext()) { + cppDataHashIterator.next(); + d->valueOwner->cppQmlTypes().load(cppDataHashIterator.key(), + cppDataHashIterator.value().exportedTypes); + } } // build an object with the context properties from C++ @@ -197,13 +201,13 @@ Context::ImportsPerDocument LinkPrivate::linkImports() // load builtin objects if (builtins.pluginTypeInfoStatus() == LibraryInfo::DumpDone || builtins.pluginTypeInfoStatus() == LibraryInfo::TypeInfoFileDone) { - valueOwner->cppQmlTypes().load(builtins.metaObjects()); + valueOwner->cppQmlTypes().load(QLatin1String("<builtins>"), builtins.metaObjects()); } else { - valueOwner->cppQmlTypes().load(CppQmlTypesLoader::defaultQtObjects); + valueOwner->cppQmlTypes().load(QLatin1String("<defaults>"), CppQmlTypesLoader::defaultQtObjects); } // load library objects shipped with Creator - valueOwner->cppQmlTypes().load(CppQmlTypesLoader::defaultLibraryObjects); + valueOwner->cppQmlTypes().load(QLatin1String("<defaultQt4>"), CppQmlTypesLoader::defaultLibraryObjects); if (document) { // do it on document first, to make sure import errors are shown @@ -483,7 +487,7 @@ bool LinkPrivate::importLibrary(Document::Ptr doc, } } else { const QString packageName = importInfo.name(); - valueOwner->cppQmlTypes().load(libraryInfo.metaObjects(), packageName); + valueOwner->cppQmlTypes().load(libraryPath, libraryInfo.metaObjects(), packageName); foreach (const CppComponentValue *object, valueOwner->cppQmlTypes().createObjectsForImport(packageName, version)) { import->object->setMember(object->className(), object); } @@ -578,7 +582,7 @@ void LinkPrivate::loadImplicitDefaultImports(Imports *imports) if (!import.object) { import.valid = true; import.info = info; - import.object = new ObjectValue(valueOwner); + import.object = new ObjectValue(valueOwner, QLatin1String("<defaults>")); foreach (const CppComponentValue *object, valueOwner->cppQmlTypes().createObjectsForImport( defaultPackage, maxVersion)) { |