diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-11-16 13:06:28 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-11-19 16:44:32 +0100 |
commit | 04ec14105ec41a67fe4d53a1962c9d68c5fd8715 (patch) | |
tree | ef07120df96a9ab93ffbebb7ef93081068b71f8e /qmake | |
parent | a3303aceeb49c6c7a5fc21e083715ddbb989a9b0 (diff) |
Change qt.conf key Qml2Imports to QmlImports
[ChangeLog][qt.conf] The key Paths/Qml2Imports has been renamed to
Paths/QmlImports. For backwards-compatibility, Paths/Qml2Imports is
still accepted and acts as default value for when Paths/QmlImports is
not present.
Fixes: QTBUG-98335
Change-Id: If7ffedd281eb8a87e8ab1a2b69a823e615c33541
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/qmakelibraryinfo.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/qmake/qmakelibraryinfo.cpp b/qmake/qmakelibraryinfo.cpp index b501cfc5f6..59a4e6eb59 100644 --- a/qmake/qmakelibraryinfo.cpp +++ b/qmake/qmakelibraryinfo.cpp @@ -148,21 +148,14 @@ static QLibraryInfo::LibraryPath hostToTargetPathEnum(int loc) Q_UNREACHABLE(); } -struct LocationInfo +static QLibraryInfoPrivate::LocationInfo defaultLocationInfo(int loc) { - QString key; - QString defaultValue; -}; - -static LocationInfo defaultLocationInfo(int loc) -{ - LocationInfo result; + QLibraryInfoPrivate::LocationInfo result; if (loc < QMakeLibraryInfo::FirstHostPath) { - QLibraryInfoPrivate::keyAndDefault(static_cast<QLibraryInfo::LibraryPath>(loc), - &result.key, &result.defaultValue); + result = QLibraryInfoPrivate::locationInfo(static_cast<QLibraryInfo::LibraryPath>(loc)); } else if (loc <= QMakeLibraryInfo::LastHostPath) { - QLibraryInfoPrivate::keyAndDefault(hostToTargetPathEnum(loc), &result.key, &result.defaultValue); + result = QLibraryInfoPrivate::locationInfo(hostToTargetPathEnum(loc)); result.key.prepend(QStringLiteral("Host")); } else if (loc == QMakeLibraryInfo::SysrootPath) { result.key = QStringLiteral("Sysroot"); @@ -219,7 +212,7 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group || (group = orig_group, false)) { fromConf = true; - LocationInfo locinfo = defaultLocationInfo(loc); + QLibraryInfoPrivate::LocationInfo locinfo = defaultLocationInfo(loc); if (!locinfo.key.isNull()) { QSettings *config = QLibraryInfoPrivate::configuration(); Q_ASSERT(config != nullptr); @@ -229,7 +222,15 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group : group == EffectivePaths ? "EffectivePaths" : "Paths")); - ret = config->value(locinfo.key).toString(); + if (locinfo.fallbackKey.isNull()) { + ret = config->value(locinfo.key, locinfo.defaultValue).toString(); + } else { + QVariant v = config->value(locinfo.key); + if (!v.isValid()) + v = config->value(locinfo.fallbackKey, locinfo.defaultValue); + ret = v.toString(); + } + if (ret.isEmpty()) { if (loc == HostPrefixPath || loc == TargetSpecPath || loc == HostSpecPath || loc == SysrootifyPrefixPath || loc == QLibraryInfo::PrefixPath) { |