aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlimport.cpp
diff options
context:
space:
mode:
authorJaeyoon Jung <jaeyoon.jung@lge.com>2021-02-19 08:11:57 +0900
committerJaeyoon Jung <jaeyoon.jung@lge.com>2021-02-22 16:20:38 +0900
commit3e413803c698d21f398daf0450c8f501204eb167 (patch)
tree50be2411dc7ea2dff5d239c215943809b39aefb6 /src/qml/qml/qqmlimport.cpp
parent0297b27cc62bc319906edd003a3fd598b0586723 (diff)
QQmlImportDatabase: Make sure the newly added import path be first
If it already exists in the import list, move it to the first place. This is as per the description of QQmlEngine::addImportPath: | The newly added path will be first in the importPathList(). Change-Id: I782d355c46ada2a46cff72e63326208f39028e01 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r--src/qml/qml/qqmlimport.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index d95ae0de0e..6540c1f301 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -2192,9 +2192,12 @@ void QQmlImportDatabase::addImportPath(const QString& path)
cPath.replace(Backslash, Slash);
}
- if (!cPath.isEmpty()
- && !fileImportPath.contains(cPath))
- fileImportPath.prepend(cPath);
+ if (!cPath.isEmpty()) {
+ if (fileImportPath.contains(cPath))
+ fileImportPath.move(fileImportPath.indexOf(cPath), 0);
+ else
+ fileImportPath.prepend(cPath);
+ }
}
/*!