diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2009-05-19 08:08:09 (GMT) |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2009-05-19 08:08:09 (GMT) |
commit | 23c781b67c838b120e7fba42bc9008d38f191330 (patch) | |
tree | 4254e4dfd099ad7066b4b02330c1edbee8398086 /src/declarative/qml/qmlengine.cpp | |
parent | 6e8f112492dec917cdcd9bc50b992eca5d41b998 (diff) | |
parent | 6db78166ddfe935a0c968a6e6205a10253d50138 (diff) | |
download | Qt-23c781b67c838b120e7fba42bc9008d38f191330.zip Qt-23c781b67c838b120e7fba42bc9008d38f191330.tar.gz Qt-23c781b67c838b120e7fba42bc9008d38f191330.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml/qmlengine.cpp')
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 0209c1d..425cba4 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -615,6 +615,35 @@ QUrl QmlEngine::componentUrl(const QUrl& src, const QUrl& baseUrl) const } /*! + Returns the list of base urls the engine browses to find sub-components. + + The search path consists of the base of the \a url, and, in the case of local files, + the directories imported using the "import" statement in \a qml. + */ +QList<QUrl> QmlEngine::componentSearchPath(const QByteArray &qml, const QUrl &url) const +{ + QList<QUrl> searchPath; + + searchPath << url.resolved(QUrl(QLatin1String("."))); + + if (QFileInfo(url.toLocalFile()).exists()) { + QmlScriptParser parser; + if (parser.parse(qml, url)) { + for (int i = 0; i < parser.imports().size(); ++i) { + QUrl importUrl = QUrl(parser.imports().at(i).uri); + if (importUrl.isRelative()) { + searchPath << url.resolved(importUrl); + } else { + searchPath << importUrl; + } + } + } + } + + return searchPath; +} + +/*! Sets the common QNetworkAccessManager, \a network, used by all QML elements instantiated by this engine. |