From e6db4206b81f3fcea13646461f56a5207d9608c2 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 10 Nov 2021 09:18:11 +0100 Subject: Fix not respected qt.conf settings Change 6fb569af951 introduces reloadOnQAppAvailable for QLibrarySettings, however it is missing a reload check for hasPaths, this breaks essentially reading custom qt.conf Add missing check. Fixes: QTBUG-97382 Fixes: QTBUG-97383 Fixes: QTBUG-97947 Pick-to: 6.2 Change-Id: I28379d9dd38357c290edd44b93d3bea489b9cefe Reviewed-by: Alexey Edelev Reviewed-by: Joerg Bornemann --- src/corelib/global/qlibraryinfo.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/corelib/global/qlibraryinfo.cpp') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index e399369d74..3a515cb9ba 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -78,16 +78,16 @@ struct QLibrarySettings { QLibrarySettings(); void load(); + bool havePaths(); QSettings *configuration(); QScopedPointer settings; - bool havePaths; + bool paths; bool reloadOnQAppAvailable; }; Q_GLOBAL_STATIC(QLibrarySettings, qt_library_settings) -QLibrarySettings::QLibrarySettings() : havePaths(false) - , reloadOnQAppAvailable(false) +QLibrarySettings::QLibrarySettings() : paths(false), reloadOnQAppAvailable(false) { load(); } @@ -99,6 +99,13 @@ QSettings *QLibrarySettings::configuration() return settings.data(); } +bool QLibrarySettings::havePaths() +{ + if (reloadOnQAppAvailable && QCoreApplication::instance() != nullptr) + load(); + return paths; +} + void QLibrarySettings::load() { // If we get any settings here, those won't change when the application shows up. @@ -109,8 +116,8 @@ void QLibrarySettings::load() // This code needs to be in the regular library, as otherwise a qt.conf that // works for qmake would break things for dynamically built Qt tools. QStringList children = settings->childGroups(); - havePaths = !children.contains(QLatin1String("Platforms")) - || children.contains(QLatin1String("Paths")); + paths = !children.contains(QLatin1String("Platforms")) + || children.contains(QLatin1String("Paths")); } } @@ -165,7 +172,7 @@ void QLibraryInfoPrivate::reload() static bool havePaths() { QLibrarySettings *ls = qt_library_settings(); - return ls && ls->havePaths; + return ls && ls->havePaths(); } #endif // settings -- cgit v1.2.3