diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-02-24 16:35:15 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-02-24 16:35:15 (GMT) |
commit | accfcb570345e9f8cf5497a2fdf4b01735c9955b (patch) | |
tree | e0e98084bcb5de01bc09621f6de731100b5931bb /src | |
parent | 6ba32ca47e9f08d4d82befb3cc6632897b3b0f6a (diff) | |
parent | 5867481c77e960a7d7b4cb3e9a7a4dffb9d68e92 (diff) | |
download | Qt-accfcb570345e9f8cf5497a2fdf4b01735c9955b.zip Qt-accfcb570345e9f8cf5497a2fdf4b01735c9955b.tar.gz Qt-accfcb570345e9f8cf5497a2fdf4b01735c9955b.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 6 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.h | 3 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 19 |
3 files changed, 20 insertions, 8 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index a9ea44a..9690406 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -266,6 +266,11 @@ QLibraryInfo::location(LibraryLocation loc) path = QT_CONFIGURE_PLUGINS_PATH; break; #endif +#ifdef QT_CONFIGURE_IMPORTS_PATH + case ImportsPath: + path = QT_CONFIGURE_IMPORTS_PATH; + break; +#endif #ifdef QT_CONFIGURE_DATA_PATH case DataPath: path = QT_CONFIGURE_DATA_PATH; @@ -470,6 +475,7 @@ QLibraryInfo::location(LibraryLocation loc) \value LibrariesPath The location of installed librarires. \value BinariesPath The location of installed Qt binaries (tools and applications). \value PluginsPath The location of installed Qt plugins. + \value ImportsPath The location of installed QML extensions to import. \value DataPath The location of general Qt data. \value TranslationsPath The location of translation information for Qt strings. \value SettingsPath The location for Qt settings. diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index e64b760..4a7ba06 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -76,7 +76,8 @@ public: TranslationsPath, SettingsPath, DemosPath, - ExamplesPath + ExamplesPath, + ImportsPath }; static QString location(LibraryLocation); // ### Qt 5: consider renaming it to path() diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 3229570..4435a5b 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -170,7 +170,6 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) QDeclarativeEnginePrivate::defineModule(); } globalClass = new QDeclarativeGlobalScriptClass(&scriptEngine); - fileImportPath.append(QLibraryInfo::location(QLibraryInfo::DataPath)+QDir::separator()+QLatin1String("qml")); // env import paths QByteArray envImportPath = qgetenv("QML_IMPORT_PATH"); @@ -1384,6 +1383,9 @@ public: paths += QFileInfo(base.toLocalFile()).path(); paths += importPath; paths += QDeclarativeEnginePrivate::get(engine)->environmentImportPath; + QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath); + if (!builtinPath.isEmpty()) + paths += builtinPath; foreach (const QString &p, paths) { dir = p+QLatin1Char('/')+url; @@ -1592,14 +1594,17 @@ QUrl QDeclarativeEnginePrivate::Imports::baseUrl() const Adds \a path as a directory where installed QML components are defined in a URL-based directory structure. - For example, if you add \c /opt/MyApp/lib/qml and then load QML + For example, if you add \c /opt/MyApp/lib/imports and then load QML that imports \c com.mycompany.Feature, then QDeclarativeEngine will look - in \c /opt/MyApp/lib/qml/com/mycompany/Feature/ for the components - provided by that module (and in the case of versioned imports, - for the \c qmldir file definiting the type version mapping. + in \c /opt/MyApp/lib/imports/com/mycompany/Feature/ for the components + provided by that module. A \c qmldir file is required for definiting the + type version mapping and possibly declarative extensions plugins. + + The engine searches in the base directory of the qml file, then + the paths added via addImportPath(), then the paths specified in the + \c QML_IMPORT_PATH environment variable, then the builtin \c ImportsPath from + QLibraryInfo. - By default, only the "qml" subdirectory of QLibraryInfo::location(QLibraryInfo::DataPath) - is included on the import path. */ void QDeclarativeEngine::addImportPath(const QString& path) { |