diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-07-26 18:17:27 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-07-30 11:26:01 +0200 |
commit | f1d213b4039e38bb9ceebaca9167fcb722a0c16e (patch) | |
tree | 81024edf48baa247879dd50b41e479feb42c4352 /src/qml/qml/qqmlimport.cpp | |
parent | 1d40ed9d22d0d1bd525932bd41875cbaf1d577d7 (diff) |
Fix bug in QQmlEngine::setImportPathList() when it had a resource path
The bug is really in QQmlImportDatabase::setImportPathList(). It was
missing the same conversions that was done in
QQmlImportDatabase::addImportPath(), so it failed to use a resource path
as a import path because it did not convert ":/foo" to "qrc:/foo".
We therefore just use addImportPath() to ensure the paths are converted
properly.
Before this, several autotests in tests/auto/qml/qqmllanguage failed on
Android, since they were calling QQmlEngine::setImportPathList() where the
list had resource paths.
Task-number: QTBUG-73512
Change-Id: Idc64f5ad20ec665df7cb57ea1c346bc0975c3b0d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 5102fb111c..7c9c0da01a 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1958,7 +1958,9 @@ void QQmlImportDatabase::setImportPathList(const QStringList &paths) if (qmlImportTrace()) qDebug().nospace() << "QQmlImportDatabase::setImportPathList: " << paths; - fileImportPath = paths; + fileImportPath.clear(); + for (auto it = paths.crbegin(); it != paths.crend(); ++it) + addImportPath(*it); // Our existing cached paths may have been invalidated clearDirCache(); |