diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-12-29 20:15:19 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-01-02 09:58:14 +0100 |
commit | 024186e7d428bcd8823cf77bd51682669d73533d (patch) | |
tree | 5806ef219de191d0d001104bc793bbfc3d48765c /src/qml/qml/qqmltypeloader.cpp | |
parent | 289c0fdc2cafd79e3178a9cd3cfc6c5bd53c8336 (diff) |
Defer loading of local qmldir files when intercepted to remote ones
The qqmltypeloader test checks this case. As long as the types are
actually loaded by the plugin it worked as we didn't register the
module before. When the types are loaded by static type registrations
in QtQuick we need to detect whether we still need to wait for a
remote qmldir file to appear in order to load color providers etc.
Change-Id: I7aa10903c6c23d1c9be01ee7ddafbdc696975407
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 989c3fe4b0..2de158884b 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -577,8 +577,10 @@ bool QQmlTypeLoader::Blob::addImport(QQmlTypeLoader::Blob::PendingImportPtr impo QString qmldirFilePath; QString qmldirUrl; - if (m_importCache.locateQmldir(importDatabase, import->uri, import->majorVersion, import->minorVersion, - &qmldirFilePath, &qmldirUrl)) { + const QQmlImports::LocalQmldirResult qmldirResult = m_importCache.locateLocalQmldir( + importDatabase, import->uri, import->majorVersion, import->minorVersion, + &qmldirFilePath, &qmldirUrl); + if (qmldirResult == QQmlImports::QmldirFound) { // This is a local library import if (!m_importCache.addLibraryImport(importDatabase, import->uri, import->qualifier, import->majorVersion, import->minorVersion, qmldirFilePath, qmldirUrl, false, errors)) @@ -603,7 +605,9 @@ bool QQmlTypeLoader::Blob::addImport(QQmlTypeLoader::Blob::PendingImportPtr impo } else { // Is this a module? if (QQmlMetaType::isAnyModule(import->uri) - || QQmlMetaType::qmlRegisterModuleTypes(import->uri, import->majorVersion)) { + || (qmldirResult != QQmlImports::QmldirInterceptedToRemote + && QQmlMetaType::qmlRegisterModuleTypes(import->uri, + import->majorVersion))) { if (!m_importCache.addLibraryImport(importDatabase, import->uri, import->qualifier, import->majorVersion, import->minorVersion, QString(), QString(), false, errors)) return false; |