From b17ccb8af9f9149d100e391af9e1c25e97a962d0 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 5 Feb 2021 18:12:42 +0100 Subject: Use QLibraryInfo::QmlImportsPath rather than Qml2ImportsPath The "2" is meaningless and there is a better name available now. Task-number: QTBUG-85064 Change-Id: I65d26b06712ed7dcf2825f16dffaa6060dd86985 Reviewed-by: Mitch Curtis Reviewed-by: Andrei Golubev --- src/qml/doc/src/qmllanguageref/syntax/imports.qdoc | 2 +- src/qml/qml/qqmlengine.cpp | 4 ++-- src/qml/qml/qqmlimport.cpp | 4 ++-- tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp | 8 ++++---- tests/auto/qml/qmlimportscanner/tst_qmlimportscanner.cpp | 2 +- tests/auto/qml/qmllint/tst_qmllint.cpp | 4 ++-- tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp | 2 +- tests/auto/qml/qqmlimport/tst_qqmlimport.cpp | 4 ++-- tools/qmlimportscanner/main.cpp | 2 +- tools/qmllint/main.cpp | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc b/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc index fdba452271..4a350877ca 100644 --- a/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc +++ b/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc @@ -289,7 +289,7 @@ default locations to be searched by the engine. By default, this list contains: \list \li The directory of the current file -\li The location specified by QLibraryInfo::Qml2ImportsPath +\li The location specified by QLibraryInfo::QmlImportsPath \li Paths specified by the \c QML2_IMPORT_PATH environment variable \li The qrc:/qt-project.org/imports path inside the resources. \endlist diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 9b410bd1bf..eb0d2f24f3 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -1920,7 +1920,7 @@ void QQmlEngine::addImportPath(const QString& path) By default, the list contains the directory of the application executable, paths specified in the \c QML2_IMPORT_PATH environment variable, - and the builtin \c Qml2ImportsPath from QLibraryInfo. + and the builtin \c QmlImportsPath from QLibraryInfo. \sa addImportPath(), setImportPathList() */ @@ -1936,7 +1936,7 @@ QStringList QQmlEngine::importPathList() const By default, the list contains the directory of the application executable, paths specified in the \c QML2_IMPORT_PATH environment variable, - and the builtin \c Qml2ImportsPath from QLibraryInfo. + and the builtin \c QmlImportsPath from QLibraryInfo. \sa importPathList(), addImportPath() */ diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 4e6a4a8928..7fa9277ab3 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1942,9 +1942,9 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e) : engine(e) { filePluginPath << QLatin1String("."); - // Search order is applicationDirPath(), qrc:/qt-project.org/imports, $QML2_IMPORT_PATH, QLibraryInfo::Qml2ImportsPath + // Search order is applicationDirPath(), qrc:/qt-project.org/imports, $QML2_IMPORT_PATH, QLibraryInfo::QmlImportsPath - QString installImportsPath = QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath); + QString installImportsPath = QLibraryInfo::path(QLibraryInfo::QmlImportsPath); addImportPath(installImportsPath); // env import paths diff --git a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp index 41b52a0a6b..04f9b1fe0c 100644 --- a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp +++ b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp @@ -245,18 +245,18 @@ void tst_QQmlPreview::blacklist() blacklist2.blacklist(":/qt-project.org"); blacklist2.blacklist(":/QtQuick/Controls/Styles"); blacklist2.blacklist(":/ExtrasImports/QtQuick/Controls/Styles"); - blacklist2.blacklist(QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath)); + blacklist2.blacklist(QLibraryInfo::path(QLibraryInfo::QmlImportsPath)); blacklist2.blacklist("/home/ulf/.local/share/QtProject/Qml Runtime/configuration.qml"); blacklist2.blacklist("/usr/share"); blacklist2.blacklist("/usr/share/QtProject/Qml Runtime/configuration.qml"); - QVERIFY(blacklist2.isBlacklisted(QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath))); + QVERIFY(blacklist2.isBlacklisted(QLibraryInfo::path(QLibraryInfo::QmlImportsPath))); blacklist2.blacklist("/usr/local/share/QtProject/Qml Runtime/configuration.qml"); blacklist2.blacklist("qml"); blacklist2.blacklist(""); // This should not remove all other paths. - QVERIFY(blacklist2.isBlacklisted(QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath) + + QVERIFY(blacklist2.isBlacklisted(QLibraryInfo::path(QLibraryInfo::QmlImportsPath) + "/QtQuick/Window.2.0")); - QVERIFY(blacklist2.isBlacklisted(QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath))); + QVERIFY(blacklist2.isBlacklisted(QLibraryInfo::path(QLibraryInfo::QmlImportsPath))); QVERIFY(blacklist2.isBlacklisted("/usr/share/QtProject/Qml Runtime/configuration.qml")); QVERIFY(blacklist2.isBlacklisted("/usr/share/stuff")); QVERIFY(blacklist2.isBlacklisted("")); diff --git a/tests/auto/qml/qmlimportscanner/tst_qmlimportscanner.cpp b/tests/auto/qml/qmlimportscanner/tst_qmlimportscanner.cpp index cfcec61f82..ca11d00915 100644 --- a/tests/auto/qml/qmlimportscanner/tst_qmlimportscanner.cpp +++ b/tests/auto/qml/qmlimportscanner/tst_qmlimportscanner.cpp @@ -121,7 +121,7 @@ void TestQmlimportscanner::runQmlimportscanner(const QString &mode, const QStrin const QString file(pathToScan); QStringList args { mode, file, - "-importPath", QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath), dataDirectory() + "-importPath", QLibraryInfo::path(QLibraryInfo::QmlImportsPath), dataDirectory() }; QString errors; QProcess process; diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index dc84e1c535..1486a9e1d3 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -155,7 +155,7 @@ void TestQmllint::qmltypes_data() { QTest::addColumn("file"); - const QString importsPath = QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath); + const QString importsPath = QLibraryInfo::path(QLibraryInfo::QmlImportsPath); QDirIterator it(importsPath, { "*.qmltypes" }, QDir::Files, QDirIterator::Subdirectories); while (it.hasNext()) @@ -359,7 +359,7 @@ QString TestQmllint::runQmllint(const QString &fileToLint, std::function handleResult, const QStringList &extraArgs) { - auto qmlImportDir = QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath); + auto qmlImportDir = QLibraryInfo::path(QLibraryInfo::QmlImportsPath); QStringList args; args << (QFileInfo(fileToLint).isAbsolute() ? fileToLint : testFile(fileToLint)) diff --git a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp index c9fe00a837..e3c8151884 100644 --- a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp +++ b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp @@ -76,7 +76,7 @@ private Q_SLOTS: void tst_qqmlextensionplugin::iidCheck_data() { QList files; - for (QDirIterator it(QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath), QDirIterator::Subdirectories); it.hasNext(); ) { + for (QDirIterator it(QLibraryInfo::path(QLibraryInfo::QmlImportsPath), QDirIterator::Subdirectories); it.hasNext(); ) { QString file = it.next(); #if defined(Q_OS_DARWIN) if (file.contains(QLatin1String(".dSYM/"))) diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index 8229b79702..92565cc591 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -166,11 +166,11 @@ void tst_QQmlImport::uiFormatLoading() void tst_QQmlImport::importPathOrder() { #ifdef Q_OS_ANDROID - QSKIP("QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath) returns bogus path on Android, but its nevertheless unusable."); + QSKIP("QLibraryInfo::path(QLibraryInfo::QmlImportsPath) returns bogus path on Android, but its nevertheless unusable."); #endif QStringList expectedImportPaths; QString appDirPath = QCoreApplication::applicationDirPath(); - QString qml2Imports = QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath); + QString qml2Imports = QLibraryInfo::path(QLibraryInfo::QmlImportsPath); #ifdef Q_OS_WIN // The drive letter has a different case as QQmlImport will // cause it to be converted after passing through QUrl diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp index 20f4a46d34..9313dee634 100644 --- a/tools/qmlimportscanner/main.cpp +++ b/tools/qmlimportscanner/main.cpp @@ -76,7 +76,7 @@ void printUsage(const QString &appNameIn) { const std::wstring appName = appNameIn.toStdWString(); #ifndef QT_BOOTSTRAPPED - const QString qmlPath = QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath); + const QString qmlPath = QLibraryInfo::path(QLibraryInfo::QmlImportsPath); #else const QString qmlPath = QStringLiteral("/home/user/dev/qt-install/qml"); #endif diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp index 428925c2e8..b41b0dcb3d 100644 --- a/tools/qmllint/main.cpp +++ b/tools/qmllint/main.cpp @@ -160,7 +160,7 @@ int main(int argv, char *argc[]) QStringList qmlImportPaths = parser.isSet(qmlImportPathsOption) ? parser.values(qmlImportPathsOption) # ifndef QT_BOOTSTRAPPED - : QStringList { QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath), QDir::currentPath() }; + : QStringList { QLibraryInfo::path(QLibraryInfo::QmlImportsPath), QDir::currentPath() }; # else : QStringList { QDir::currentPath() }; # endif -- cgit v1.2.3