summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-11-30 13:49:46 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2017-11-30 15:10:22 +0000
commitdac71f3d6f6bc4f159f6107c792bc70cfe7c308e (patch)
treeb9526bfdd34458a64e86b27bd482a0f58ab6a3e0
parentcc46992fbb94f1775ac22aa23b42d76f810a5913 (diff)
Fix QQmlImportsPrivate::resolvedUri()v5.10.0-rc3v5.10.0
Qt Quick Controls 2 styles have a version in the middle of the path/URI (e.g. qml/QtQuick/Controls.2/Material). The resolvedUri() helper method, which is used by addFileImport() for implicit imports, was never taught to deal with this type of versioning. It was only attempting to remove the version from the end. Change-Id: Ibdf23dc6c3b0794527d5f9330602858291c23e01 Task-number: QTBUG-64868 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/qml/qml/qqmlimport.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 334bc8b28e..a7cafa1a93 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -1231,10 +1231,12 @@ QString QQmlImportsPrivate::resolvedUri(const QString &dir_arg, QQmlImportDataba
stableRelativePath.replace(Backslash, Slash);
// remove optional versioning in dot notation from uri
- int lastSlash = stableRelativePath.lastIndexOf(Slash);
- if (lastSlash >= 0) {
- int versionDot = stableRelativePath.indexOf(Dot, lastSlash);
- if (versionDot >= 0)
+ int versionDot = stableRelativePath.lastIndexOf(Dot);
+ if (versionDot >= 0) {
+ int nextSlash = stableRelativePath.indexOf(Slash, versionDot);
+ if (nextSlash >= 0)
+ stableRelativePath.remove(versionDot, nextSlash - versionDot);
+ else
stableRelativePath = stableRelativePath.left(versionDot);
}