diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-05-15 13:35:10 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-05-15 14:31:27 +0000 |
commit | b8a3b90144041774d02d8e33ca1c92e833e633fb (patch) | |
tree | a1a5280665ef3497ba06e941aa9a7d77d7089241 /src/qml/qml/qqmlimport.cpp | |
parent | 6e5251dd3d7b21b67693a79d3470ec2ba80ba97e (diff) |
Fix QQmlExtensionPlugin::baseUrl() in static builds
Don't assume the file system. Everything is bundled into resources
in static builds. For example, for the QML modules in Qt, the base URL
was "file::/qt-project.org/imports/QtFoo/Bar". This patch fixes it so
that the base URL becomes "qrc:/qt-project.org/imports/QtFoo/Bar".
This fix removes the need for this type of special casing in QQC2 when
resolving the URL for qmlRegisterType() for internal QML composite
types:
#ifdef QT_STATIC
QString url = QLatin1String("qrc") + baseUrl().path();
#else
QString url = baseUrl().toString();
#endif
The piece of code originates from QQC2 commit(s) e3c52b2 (and 199962a)
that were presumably fixing support for static builds.
Change-Id: I4fff354c3ed5309843e9122a0175593f4fbb5661
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 005db4248e..f85fecb5dd 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -2048,7 +2048,7 @@ bool QQmlImportDatabase::registerPluginTypes(QObject *instance, const QString &b if (QQmlExtensionPlugin *plugin = qobject_cast<QQmlExtensionPlugin *>(instance)) { // basepath should point to the directory of the module, not the plugin file itself: - QQmlExtensionPluginPrivate::get(plugin)->baseUrl = QUrl::fromLocalFile(basePath); + QQmlExtensionPluginPrivate::get(plugin)->baseUrl = QQmlImports::urlFromLocalFileOrQrcOrUrl(basePath); } iface->registerTypes(moduleId); |