diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2010-05-19 12:04:35 (GMT) |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2010-05-19 12:33:09 (GMT) |
commit | e758b6fcbda482d1482c2a7258413711801bd746 (patch) | |
tree | a37245c883fd228ef4f44dae0d7deb91d632be74 | |
parent | c9057924dfa5da4d18030720431a92d2593f85df (diff) | |
download | Qt-e758b6fcbda482d1482c2a7258413711801bd746.zip Qt-e758b6fcbda482d1482c2a7258413711801bd746.tar.gz Qt-e758b6fcbda482d1482c2a7258413711801bd746.tar.bz2 |
Search for QML import libraries also in application directory
Add QCoreApplication::applicationLibraryPath again to the list of
directories to search for possible QML plugins.
Task-number: QTBUG-10771
Reviewed-by: mae
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 10 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeimport.cpp | 14 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 79f8a17..3ab94d3 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1550,8 +1550,9 @@ void QDeclarativeEngine::addImportPath(const QString& path) provided by that module. A \c qmldir file is required for defining the type version mapping and possibly declarative extensions plugins. - By default, the list contains the paths specified in the \c QML_IMPORT_PATH environment - variable, then the builtin \c ImportsPath from QLibraryInfo. + By default, the list contains the directory of the application executable, + paths specified in the \c QML_IMPORT_PATH environment variable, + and the builtin \c ImportsPath from QLibraryInfo. \sa addImportPath() setImportPathList() */ @@ -1565,8 +1566,9 @@ QStringList QDeclarativeEngine::importPathList() const Sets \a paths as the list of directories where the engine searches for installed modules in a URL-based directory structure. - By default, the list contains the paths specified in the \c QML_IMPORT_PATH environment - variable, then the builtin \c ImportsPath from QLibraryInfo. + By default, the list contains the directory of the application executable, + paths specified in the \c QML_IMPORT_PATH environment variable, + and the builtin \c ImportsPath from QLibraryInfo. \sa importPathList() addImportPath() */ diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index 576e048..cb36818 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -576,9 +576,9 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e) { filePluginPath << QLatin1String("."); - QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath); - if (!builtinPath.isEmpty()) - addImportPath(builtinPath); + // Search order is applicationDirPath(), $QML_IMPORT_PATH, QLibraryInfo::ImportsPath + + addImportPath(QLibraryInfo::location(QLibraryInfo::ImportsPath)); // env import paths QByteArray envImportPath = qgetenv("QML_IMPORT_PATH"); @@ -592,6 +592,8 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e) for (int ii = paths.count() - 1; ii >= 0; --ii) addImportPath(paths.at(ii)); } + + addImportPath(QCoreApplication::applicationDirPath()); } QDeclarativeImportDatabase::~QDeclarativeImportDatabase() @@ -843,6 +845,9 @@ void QDeclarativeImportDatabase::addImportPath(const QString& path) if (qmlImportTrace()) qDebug() << "QDeclarativeImportDatabase::addImportPath" << path; + if (path.isEmpty()) + return; + QUrl url = QUrl(path); QString cPath; @@ -853,7 +858,8 @@ void QDeclarativeImportDatabase::addImportPath(const QString& path) cPath = path; } - if (!fileImportPath.contains(cPath)) + if (!cPath.isEmpty() + && !fileImportPath.contains(cPath)) fileImportPath.prepend(cPath); } |