diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-03-05 18:12:31 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-03-11 10:00:01 +0100 |
commit | a08b1f63595f61e7fa12b04d516ec20396906c9e (patch) | |
tree | 595de4fd849c1e865a5c0ac9590addf416d4bfc8 /src/corelib/global/qlibraryinfo.cpp | |
parent | 3c12ab974ffa7aa51ca157989997f6e10c1c2259 (diff) |
Read QLibraryInfo paths directly from QLibraryInfo and not from qmakeconfig.cpp
Change-Id: I1db1c871ec6b4e572bd36df6aff7a5be8a4a706c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/corelib/global/qlibraryinfo.cpp')
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index f6c755b750..0bd6674b43 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -476,6 +476,25 @@ static QString getPrefix() #endif } +Q_CORE_EXPORT void qlibraryinfo_keyAndDefault(QLibraryInfo::LibraryPath loc, QString *key, + QString *value) +{ + if (unsigned(loc) < sizeof(qtConfEntries)/sizeof(qtConfEntries[0])) { + *key = QLatin1String(qtConfEntries[loc].key); + *value = QLatin1String(qtConfEntries[loc].value); + } +#ifndef Q_OS_WIN // On Windows we use the registry + else if (loc == QLibraryInfo::SettingsPath) { + *key = QLatin1String("Settings"); + *value = QLatin1String("."); + } +#endif + else { + key->clear(); + value->clear(); + } +} + /*! \fn QString QLibraryInfo::location(LibraryLocation loc) \obsolete Use path() instead. @@ -499,17 +518,7 @@ QString QLibraryInfo::path(LibraryPath p) QString key; QString defaultValue; - if (unsigned(loc) < sizeof(qtConfEntries)/sizeof(qtConfEntries[0])) { - key = QLatin1String(qtConfEntries[loc].key); - defaultValue = QLatin1String(qtConfEntries[loc].value); - } -#ifndef Q_OS_WIN // On Windows we use the registry - else if (loc == SettingsPath) { - key = QLatin1String("Settings"); - defaultValue = QLatin1String("."); - } -#endif - + qlibraryinfo_keyAndDefault(loc, &key, &defaultValue); if (!key.isNull()) { QSettings *config = QLibraryInfoPrivate::configuration(); config->beginGroup(QLatin1String("Paths")); |