aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/qml/qqmltypeloader.cpp6
-rw-r--r--tests/auto/qml/qqmltypeloader/data/qrcRootPath.qml4
-rw-r--r--tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp8
3 files changed, 17 insertions, 1 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index df6a8f1500..9e5bc0b021 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -1495,7 +1495,11 @@ bool QQmlTypeLoader::Blob::addImport(const QV4::CompiledData::Import *import, QL
bool incomplete = false;
- QUrl qmldirUrl = finalUrl().resolved(QUrl(importUri + QLatin1String("/qmldir")));
+ QUrl importUrl(importUri);
+ QString path = importUrl.path();
+ path.append(QLatin1String(path.endsWith(QLatin1Char('/')) ? "qmldir" : "/qmldir"));
+ importUrl.setPath(path);
+ QUrl qmldirUrl = finalUrl().resolved(importUrl);
if (!QQmlImports::isLocal(qmldirUrl)) {
// This is a remote file; the import is currently incomplete
incomplete = true;
diff --git a/tests/auto/qml/qqmltypeloader/data/qrcRootPath.qml b/tests/auto/qml/qqmltypeloader/data/qrcRootPath.qml
new file mode 100644
index 0000000000..bdbee4eb59
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/qrcRootPath.qml
@@ -0,0 +1,4 @@
+import QtQml 2.12
+import "qrc:/"
+
+QtObject {}
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
index 0c4abf19f4..52c722aac8 100644
--- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
+++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
@@ -56,6 +56,7 @@ private slots:
void qmlSingletonWithinModule();
void multiSingletonModule();
void implicitComponentModule();
+ void qrcRootPathUrl();
};
void tst_QQMLTypeLoader::testLoadComplete()
@@ -503,6 +504,13 @@ void tst_QQMLTypeLoader::implicitComponentModule()
checkCleanCacheLoad(QLatin1String("implicitComponentModule"));
}
+void tst_QQMLTypeLoader::qrcRootPathUrl()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("qrcRootPath.qml"));
+ QCOMPARE(component.status(), QQmlComponent::Ready);
+}
+
QTEST_MAIN(tst_QQMLTypeLoader)
#include "tst_qqmltypeloader.moc"