diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2013-02-11 19:07:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-19 10:09:39 +0100 |
commit | 0dc1c0554465d4e2546b75254371f3b8b01e957d (patch) | |
tree | 8704c83cc18b507b1ea11b38fb57ae525702b097 /src/qml/qml/qqmlimport.cpp | |
parent | 99ad368cf810723643ae76bba6a1adba3321b18f (diff) |
Make the base URL available to QQmlExtensionPlugin
This is for the benefit of any plugin which needs to interact with the QML
files or related assets which are also located in its import directory.
Change-Id: Id23ec279b4d017bd3f620c3a7916dac9f9ac29bc
Reviewed-by: Alan Alpert <aalpert@rim.com>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 95b59f93f4..5374f2d1ad 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -49,6 +49,8 @@ #include <QtCore/qlibraryinfo.h> #include <QtCore/qreadwritelock.h> #include <QtQml/qqmlextensioninterface.h> +#include <QtQml/qqmlextensionplugin.h> +#include <private/qqmlextensionplugin_p.h> #include <private/qqmlglobal_p.h> #include <private/qqmltypenamecache_p.h> #include <private/qqmlengine_p.h> @@ -1683,6 +1685,10 @@ bool QQmlImportDatabase::importPlugin(const QString &filePath, const QString &ur QQmlMetaType::setTypeRegistrationNamespace(typeNamespace); + if (QQmlExtensionPlugin *plugin = qobject_cast<QQmlExtensionPlugin *>(instance)) { + // Set the directory, not the library file itself + QQmlExtensionPluginPrivate::get(plugin)->baseUrl = QUrl::fromLocalFile(fileInfo.absolutePath()); + } iface->registerTypes(moduleId); registrationFailures = QQmlMetaType::typeRegistrationFailures(); |