diff options
author | Alan Alpert <aalpert@rim.com> | 2012-12-08 13:57:12 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-27 20:40:28 +0100 |
commit | 1f3038d2144603c687d85b0a7962322d3c9ae422 (patch) | |
tree | 461b411e8b5b98a0f37495a51e24687d4ca675f5 /src/qml/qml/qqmlimport.cpp | |
parent | f7ada9b9325c7adc10da6a3a4e7f887452682260 (diff) |
Delay loading implicit import
As a performance improvement to avoid extra filesystem access, only
import "." if it is needed for type resolution.
Change-Id: If9be25deb3205f8c81f9f418404d9fb41bebb84f
Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index d3ec9e67f7..f793ca9604 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -260,7 +260,7 @@ public: QQmlImportNamespace::Import *addImportToNamespace(QQmlImportNamespace *nameSpace, const QString &uri, const QString &url, int vmaj, int vmin, QQmlScript::Import::Type type, - QList<QQmlError> *errors); + QList<QQmlError> *errors, bool lowPrecedence = false); }; /*! @@ -1003,7 +1003,7 @@ QQmlImportNamespace *QQmlImportsPrivate::importNamespace(const QString &prefix) QQmlImportNamespace::Import *QQmlImportsPrivate::addImportToNamespace(QQmlImportNamespace *nameSpace, const QString &uri, const QString &url, int vmaj, int vmin, QQmlScript::Import::Type type, - QList<QQmlError> *errors) + QList<QQmlError> *errors, bool lowPrecedence) { Q_ASSERT(nameSpace); Q_ASSERT(errors); @@ -1017,7 +1017,11 @@ QQmlImportNamespace::Import *QQmlImportsPrivate::addImportToNamespace(QQmlImport import->minversion = vmin; import->isLibrary = (type == QQmlScript::Import::Library); - nameSpace->imports.prepend(import); + if (lowPrecedence) + nameSpace->imports.append(import); + else + nameSpace->imports.prepend(import); + return import; } @@ -1162,7 +1166,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix if (!url.endsWith(Slash) && !url.endsWith(Backslash)) url += Slash; - QQmlImportNamespace::Import *inserted = addImportToNamespace(nameSpace, importUri, url, vmaj, vmin, QQmlScript::Import::File, errors); + QQmlImportNamespace::Import *inserted = addImportToNamespace(nameSpace, importUri, url, vmaj, vmin, QQmlScript::Import::File, errors, isImplicitImport); Q_ASSERT(inserted); if (!incomplete && !qmldirIdentifier.isEmpty()) { @@ -1238,6 +1242,8 @@ bool QQmlImportsPrivate::updateQmldirContent(const QString &uri, const QString & Adds an implicit "." file import. This is equivalent to calling addFileImport(), but error messages related to the path or qmldir file not existing are suppressed. + + Additionally, this will add the import with lowest instead of highest precedence. */ bool QQmlImports::addImplicitImport(QQmlImportDatabase *importDb, QList<QQmlError> *errors) { |