From 0dae641331bbd21207f6c74a7a34e0c74103d61e Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 8 Nov 2018 15:53:40 +0100 Subject: [PATCH 1/4] QAbstractSocket::Bind: clarify some details The function's documentation needlessly repeated parts of its first line. The BindFlag enum it takes as a parameter confused readers by saying an option is ignored on Windows, failing to make clear that it is so because that option is what Windows does by default. Tidied some phrasing and typos in the process. Fixes: QTBUG-52364 Change-Id: Ia6510caff7ec80216eefccf41fb009b1357e4b2e Reviewed-by: Andy Shaw Reviewed-by: Paul Wicking --- src/network/socket/qabstractsocket.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 13e10e4102..a33dcb5955 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -424,7 +424,7 @@ Note that by combining this option with ReuseAddressHint, you will also allow your service to rebind an existing shared address. On Unix, this is equivalent to the SO_REUSEADDR socket option. On Windows, - this option is ignored. + this is the default behavior, so this option is ignored. \value DontShareAddress Bind the address and port exclusively, so that no other services are allowed to rebind. By passing this option to @@ -444,7 +444,7 @@ \value DefaultForPlatform The default option for the current platform. On Unix and \macos, this is equivalent to (DontShareAddress - + ReuseAddressHint), and on Windows, its equivalent to ShareAddress. + + ReuseAddressHint), and on Windows, it is equivalent to ShareAddress. */ /*! \enum QAbstractSocket::PauseMode @@ -455,7 +455,7 @@ The only notification currently supported is QSslSocket::sslErrors(). \value PauseNever Do not pause data transfer on the socket. This is the - default and matches the behaviour of Qt 4. + default and matches the behavior of Qt 4. \value PauseOnSslErrors Pause data transfer on the socket upon receiving an SSL error notification. I.E. QSslSocket::sslErrors(). */ @@ -1538,11 +1538,9 @@ void QAbstractSocket::setPauseMode(PauseModes pauseMode) Binds to \a address on port \a port, using the BindMode \a mode. - Binds this socket to the address \a address and the port \a port. - For UDP sockets, after binding, the signal QUdpSocket::readyRead() is emitted whenever a UDP datagram arrives on the specified address and port. - Thus, This function is useful to write UDP servers. + Thus, this function is useful to write UDP servers. For TCP sockets, this function may be used to specify which interface to use for an outgoing connection, which is useful in case of multiple network From 15b1c3fd9b82c8a29148c73be7aa4e8b2e07add1 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 9 Nov 2018 15:44:02 +0100 Subject: [PATCH 2/4] Purge some unused code for the OpenGL library name We had a global static, a setter for it (that's nowhere used within Qt code) and a getter for it whose only use was commented out. Neither was declared in any header; the getter's commented-out client had a local extern declaration at the point of (non-)use. Found while reviewing a change to the next few lines of code after the commented-out use of the getter. Change-Id: I393d56219cb7dd7cf836ca80e1bdd605a2914003 Reviewed-by: Laszlo Agocs Reviewed-by: Gatis Paeglis --- src/opengl/qgl.cpp | 19 ------------------- .../xcb_glx/qglxintegration.cpp | 2 -- 2 files changed, 21 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index d9f2113c14..78c2dfda7c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -5195,25 +5195,6 @@ void QGLWidgetPrivate::cleanupColormaps() { } -Q_GLOBAL_STATIC(QString, qt_gl_lib_name) - -void qt_set_gl_library_name(const QString& name) -{ - qt_gl_lib_name()->operator=(name); -} - -const QString qt_gl_library_name() -{ - if (qt_gl_lib_name()->isNull()) { -# if defined(QT_OPENGL_ES_2) - return QLatin1String("GLESv2"); -# else - return QLatin1String("GL"); -# endif - } - return *qt_gl_lib_name(); -} - void QGLContextGroup::addShare(const QGLContext *context, const QGLContext *share) { Q_ASSERT(context && share); if (context->d_ptr->group == share->d_ptr->group) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index 741885e321..93cd3e215f 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -648,8 +648,6 @@ QFunctionPointer QGLXContext::getProcAddress(const char *procName) #endif { #if QT_CONFIG(library) - extern const QString qt_gl_library_name(); -// QLibrary lib(qt_gl_library_name()); QLibrary lib(QLatin1String("GL")); if (!lib.load()) lib.setFileNameAndVersion(QLatin1String("GL"), 1); From cd201b2c2c2849fea0c5a38ffd979cd9d5b24997 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 13 Nov 2018 11:15:44 +0100 Subject: [PATCH 3/4] Adjust QTRY_IMPL()'s default timestep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was previously using 50ms steps, which was a bad choice for client code whose total time-out was comparable to 50ms or less. Reduce the time-step so that we loop several times within the timeout (but make sure it's never zero, by adding 1ms). Change-Id: I0428a7741c0741dfb312e40ae1eda900050195ab Reviewed-by: Jędrzej Nowacki --- src/testlib/qtestcase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 54669c11de..fbc251a2a2 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -150,7 +150,7 @@ do {\ // Ideally we'd use qWaitFor instead of QTRY_LOOP_IMPL, but due // to a compiler bug on MSVC < 2017 we can't (see QTBUG-59096) #define QTRY_IMPL(expr, timeout)\ - const int qt_test_step = 50; \ + const int qt_test_step = timeout < 350 ? timeout / 7 + 1 : 50; \ const int qt_test_timeoutValue = timeout; \ QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); \ QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)\ From 527406cbd99f44470ef87468b73c18df949e8ac7 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 12 Nov 2018 09:40:47 +0100 Subject: [PATCH 4/4] Modernize the "settings" feature Change-Id: I9b8a61ecb1413b513ae5c9e77d3ee1b3e8b6562c Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qconfig-bootstrapped.h | 2 ++ src/corelib/global/qlibraryinfo.cpp | 14 +++++----- src/corelib/io/io.pri | 26 +++++++++++++------ src/corelib/io/qsettings.cpp | 4 --- src/corelib/io/qsettings.h | 7 +---- src/corelib/io/qsettings_mac.cpp | 2 -- src/corelib/io/qsettings_win.cpp | 3 --- src/corelib/io/qsettings_winrt.cpp | 3 --- src/corelib/kernel/qcoreapplication_p.h | 2 ++ src/gui/image/qiconloader.cpp | 6 +++-- src/gui/kernel/qplatformdialoghelper.cpp | 6 +++-- .../kernel/qplatforminputcontextfactory.cpp | 6 ++--- .../mac/qcoretextfontdatabase.mm | 18 ++++++++----- .../fontdatabases/mac/qfontengine_coretext.mm | 2 ++ .../genericunix/qgenericunixservices.cpp | 4 ++- .../themes/genericunix/qgenericunixthemes.cpp | 10 ++++--- .../themes/genericunix/qgenericunixthemes_p.h | 4 +-- src/widgets/dialogs/qcolordialog.cpp | 2 ++ src/widgets/dialogs/qfiledialog.cpp | 12 +++++---- src/widgets/dialogs/qfiledialog_p.h | 2 +- src/widgets/kernel/qapplication_p.h | 2 +- src/widgets/styles/qcommonstyle.cpp | 2 ++ tests/auto/corelib/io/io.pro | 3 +++ 23 files changed, 83 insertions(+), 59 deletions(-) diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 229b4d17a1..f62137fe66 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -126,11 +126,13 @@ #define QT_FEATURE_commandlineparser -1 #define QT_NO_COMPRESS #define QT_JSON_READONLY +#define QT_FEATURE_settings 1 #define QT_NO_STANDARDPATHS #define QT_FEATURE_textcodec -1 #else #define QT_FEATURE_codecs -1 #define QT_FEATURE_commandlineparser 1 +#define QT_FEATURE_settings -1 #define QT_FEATURE_textcodec 1 #endif diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index e727f00c8e..4119012d85 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -41,7 +41,9 @@ #include "qdir.h" #include "qstringlist.h" #include "qfile.h" +#if QT_CONFIG(settings) #include "qsettings.h" +#endif #include "qlibraryinfo.h" #include "qscopedpointer.h" @@ -67,7 +69,7 @@ QT_BEGIN_NAMESPACE extern void qDumpCPUFeatures(); // in qsimd.cpp -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) struct QLibrarySettings { @@ -204,7 +206,7 @@ QSettings *QLibraryInfoPrivate::findConfiguration() return 0; //no luck } -#endif // QT_NO_SETTINGS +#endif // settings /*! \class QLibraryInfo @@ -464,7 +466,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) #endif // QT_BUILD_QMAKE, started inside location ! QString ret; bool fromConf = false; -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) #ifdef QT_BUILD_QMAKE // Logic for choosing the right data source: if EffectivePaths are requested // and qt.conf with that section is present, use it, otherwise fall back to @@ -547,7 +549,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) ret = QDir::fromNativeSeparators(ret); } } -#endif // QT_NO_SETTINGS +#endif // settings #ifndef QT_BUILD_QMAKE_BOOTSTRAP if (!fromConf) { @@ -646,7 +648,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) QStringList QLibraryInfo::platformPluginArguments(const QString &platformName) { -#if !defined(QT_BUILD_QMAKE) && !defined(QT_NO_SETTINGS) +#if !defined(QT_BUILD_QMAKE) && QT_CONFIG(settings) QScopedPointer settings(QLibraryInfoPrivate::findConfiguration()); if (!settings.isNull()) { const QString key = QLatin1String(platformsSection) @@ -657,7 +659,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName) } #else Q_UNUSED(platformName); -#endif // !QT_BUILD_QMAKE && !QT_NO_SETTINGS +#endif // !QT_BUILD_QMAKE && settings return QStringList(); } diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index c6a5407e51..086d642c26 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -34,8 +34,6 @@ HEADERS += \ io/qurlquery.h \ io/qurltlds_p.h \ io/qtldurl_p.h \ - io/qsettings.h \ - io/qsettings_p.h \ io/qfsfileengine_p.h \ io/qfsfileengine_iterator_p.h \ io/qfilesystementry_p.h \ @@ -73,7 +71,6 @@ SOURCES += \ io/qurlidna.cpp \ io/qurlquery.cpp \ io/qurlrecode.cpp \ - io/qsettings.cpp \ io/qfsfileengine.cpp \ io/qfsfileengine_iterator.cpp \ io/qfilesystementry.cpp \ @@ -121,6 +118,24 @@ qtConfig(processenvironment) { SOURCES += io/qprocess_unix.cpp } +qtConfig(settings) { + SOURCES += \ + io/qsettings.cpp + HEADERS += \ + io/qsettings.h \ + io/qsettings_p.h + + win32 { + !winrt { + SOURCES += io/qsettings_win.cpp + } else { + SOURCES += io/qsettings_winrt.cpp + } + } else: darwin:!nacl { + SOURCES += io/qsettings_mac.cpp + } +} + win32 { SOURCES += io/qfsfileengine_win.cpp SOURCES += io/qlockfile_win.cpp @@ -136,7 +151,6 @@ win32 { io/qwindowspipewriter_p.h SOURCES += \ - io/qsettings_win.cpp \ io/qstandardpaths_win.cpp \ io/qstorageinfo_win.cpp \ io/qwindowspipereader.cpp \ @@ -146,7 +160,6 @@ win32 { } else { SOURCES += \ io/qstandardpaths_winrt.cpp \ - io/qsettings_winrt.cpp \ io/qstorageinfo_stub.cpp } } else:unix { @@ -162,9 +175,6 @@ win32 { ../3rdparty/forkfd/forkfd.h INCLUDEPATH += ../3rdparty/forkfd } - !nacl:mac: { - SOURCES += io/qsettings_mac.cpp - } mac { SOURCES += io/qstorageinfo_mac.cpp qtConfig(processenvironment): \ diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 580fe6caf3..68e77c4167 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -41,8 +41,6 @@ #include "qplatformdefs.h" #include "qsettings.h" -#ifndef QT_NO_SETTINGS - #include "qsettings_p.h" #include "qcache.h" #include "qfile.h" @@ -3573,5 +3571,3 @@ QT_END_NAMESPACE #ifndef QT_BOOTSTRAPPED #include "moc_qsettings.cpp" #endif - -#endif // QT_NO_SETTINGS diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h index ccfec787a6..7a9eebe11b 100644 --- a/src/corelib/io/qsettings.h +++ b/src/corelib/io/qsettings.h @@ -45,10 +45,7 @@ #include #include -QT_BEGIN_NAMESPACE -QT_END_NAMESPACE - -#ifndef QT_NO_SETTINGS +QT_REQUIRE_CONFIG(settings); #include @@ -208,6 +205,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_SETTINGS - #endif // QSETTINGS_H diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index aa14d8435a..9a1b578f7e 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qsettings.h" -#ifndef QT_NO_SETTINGS #include "qsettings_p.h" #include "qdatetime.h" @@ -664,4 +663,3 @@ bool QConfFileSettingsPrivate::writePlistFile(QIODevice &file, const ParsedSetti } QT_END_NAMESPACE -#endif //QT_NO_SETTINGS diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index edcae16776..bbaf45a95b 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -39,8 +39,6 @@ #include "qsettings.h" -#ifndef QT_NO_SETTINGS - #include "qsettings_p.h" #include "qvector.h" #include "qmap.h" @@ -859,4 +857,3 @@ QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::F } QT_END_NAMESPACE -#endif // QT_NO_SETTINGS diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp index 209b56d920..c54e5861f0 100644 --- a/src/corelib/io/qsettings_winrt.cpp +++ b/src/corelib/io/qsettings_winrt.cpp @@ -39,8 +39,6 @@ #include "qsettings.h" -#ifndef QT_NO_SETTINGS - #include "qsettings_p.h" #include "qvector.h" #include "qmap.h" @@ -690,4 +688,3 @@ QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::F } QT_END_NAMESPACE -#endif // QT_NO_SETTINGS diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index cd995c17f1..b3479414ab 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -53,7 +53,9 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qtranslator.h" +#if QT_CONFIG(settings) #include "QtCore/qsettings.h" +#endif #ifndef QT_NO_QOBJECT #include "private/qobject_p.h" #endif diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 1ea4f1340b..3695408597 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -50,7 +50,9 @@ #include #include #include +#if QT_CONFIG(settings) #include +#endif #include #include @@ -338,7 +340,7 @@ QIconTheme::QIconTheme(const QString &themeName) m_valid = true; } } -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) if (themeIndex.exists()) { const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat); const QStringList keys = indexReader.allKeys(); @@ -397,7 +399,7 @@ QIconTheme::QIconTheme(const QString &themeName) if (!m_parents.contains(QLatin1String("hicolor"))) m_parents.append(QLatin1String("hicolor")); } -#endif //QT_NO_SETTINGS +#endif // settings } QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName, diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index b456c1ca31..61479016a2 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -42,7 +42,9 @@ #include #include #include +#if QT_CONFIG(settings) #include +#endif #include #include @@ -283,7 +285,7 @@ QColorDialogStaticData::QColorDialogStaticData() : customSet(false) void QColorDialogStaticData::readSettings() { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) const QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); for (int i = 0; i < int(CustomColorCount); ++i) { const QVariant v = settings.value(QLatin1String("Qt/customColors/") + QString::number(i)); @@ -295,7 +297,7 @@ void QColorDialogStaticData::readSettings() void QColorDialogStaticData::writeSettings() const { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) if (customSet) { const_cast(this)->customSet = false; QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); diff --git a/src/gui/kernel/qplatforminputcontextfactory.cpp b/src/gui/kernel/qplatforminputcontextfactory.cpp index c59d89fabe..df7b95d8df 100644 --- a/src/gui/kernel/qplatforminputcontextfactory.cpp +++ b/src/gui/kernel/qplatforminputcontextfactory.cpp @@ -48,14 +48,14 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QPlatformInputContextFactoryInterface_iid, QLatin1String("/platforminputcontexts"), Qt::CaseInsensitive)) #endif QStringList QPlatformInputContextFactory::keys() { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) return loader()->keyMap().values(); #else return QStringList(); @@ -70,7 +70,7 @@ QString QPlatformInputContextFactory::requested() QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key) { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) if (!key.isEmpty()) { QStringList paramList = key.split(QLatin1Char(':')); const QString platform = paramList.takeFirst().toLower(); diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 91c2dc8cf0..898432e602 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -50,7 +50,9 @@ #include "qcoretextfontdatabase_p.h" #include "qfontengine_coretext_p.h" +#if QT_CONFIG(settings) #include +#endif #include #ifndef QT_NO_FREETYPE #include @@ -116,21 +118,25 @@ QCoreTextFontDatabase::QCoreTextFontDatabase() : m_hasPopulatedAliases(false) { #ifdef Q_OS_MACX - QSettings appleSettings(QLatin1String("apple.com")); - QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold")); - if (appleValue.isValid()) - QCoreTextFontEngine::antialiasingThreshold = appleValue.toInt(); - /* font_smoothing = 0 means no smoothing, while 1-3 means subpixel antialiasing with different hinting styles (but we don't care about the exact value, only if subpixel rendering is available or not) */ int font_smoothing = 0; + +#if QT_CONFIG(settings) + QSettings appleSettings(QLatin1String("apple.com")); + QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold")); + if (appleValue.isValid()) + QCoreTextFontEngine::antialiasingThreshold = appleValue.toInt(); + appleValue = appleSettings.value(QLatin1String("AppleFontSmoothing")); if (appleValue.isValid()) { font_smoothing = appleValue.toInt(); - } else { + } else +#endif // settings + { // non-Apple displays do not provide enough information about subpixel rendering so // draw text with cocoa and compare pixel colors to see if subpixel rendering is enabled int w = 10; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 98b753eff9..57ae622891 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -41,7 +41,9 @@ #include #include +#if QT_CONFIG(settings) #include +#endif #include diff --git a/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/src/platformsupport/services/genericunix/qgenericunixservices.cpp index cb1e367b9f..e63eb3b5b2 100644 --- a/src/platformsupport/services/genericunix/qgenericunixservices.cpp +++ b/src/platformsupport/services/genericunix/qgenericunixservices.cpp @@ -45,7 +45,9 @@ #if QT_CONFIG(process) # include #endif +#if QT_CONFIG(settings) #include +#endif #include #include @@ -93,7 +95,7 @@ static inline QByteArray detectDesktopEnvironment() // This can be a path in /usr/share/xsessions int slash = desktopSession.lastIndexOf('/'); if (slash != -1) { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) QSettings desktopFile(QFile::decodeName(desktopSession + ".desktop"), QSettings::IniFormat); desktopFile.beginGroup(QStringLiteral("Desktop Entry")); QByteArray desktopName = desktopFile.value(QStringLiteral("DesktopNames")).toByteArray(); diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index 43d49cbbc8..1003812767 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -53,7 +53,9 @@ #include #endif #include +#if QT_CONFIG(settings) #include +#endif #include #include #include @@ -261,7 +263,7 @@ static QIcon xdgFileIcon(const QFileInfo &fileInfo) } #endif -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) class QKdeThemePrivate : public QPlatformThemePrivate { public: @@ -688,7 +690,7 @@ QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const } #endif -#endif // QT_NO_SETTINGS +#endif // settings /*! \class QGnomeTheme @@ -834,7 +836,7 @@ QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name) { if (name == QLatin1String(QGenericUnixTheme::name)) return new QGenericUnixTheme; -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) if (name == QLatin1String(QKdeTheme::name)) if (QPlatformTheme *kdeTheme = QKdeTheme::createKdeTheme()) return kdeTheme; @@ -859,7 +861,7 @@ QStringList QGenericUnixTheme::themeNames() const QList desktopNames = desktopEnvironment.split(':'); for (const QByteArray &desktopName : desktopNames) { if (desktopEnvironment == "KDE") { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) result.push_back(QLatin1String(QKdeTheme::name)); #endif } else if (gtkBasedEnvironments.contains(desktopName)) { diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h index 865a624694..a5963b79ea 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h @@ -96,7 +96,7 @@ public: static const char *name; }; -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) class QKdeThemePrivate; class QKdeTheme : public QPlatformTheme @@ -123,7 +123,7 @@ public: static const char *name; }; -#endif // QT_NO_SETTINGS +#endif // settings class QGnomeThemePrivate; diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 99946d341d..7f137fe848 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -57,7 +57,9 @@ #include "qpainter.h" #include "qpixmap.h" #include "qpushbutton.h" +#if QT_CONFIG(settings) #include "qsettings.h" +#endif #include "qsharedpointer.h" #include "qstyle.h" #include "qstyleoption.h" diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 778e8556c7..8a51c7d186 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -57,7 +57,9 @@ #include #endif #include +#if QT_CONFIG(settings) #include +#endif #include #if QT_CONFIG(mimetype) #include @@ -383,7 +385,7 @@ QFileDialog::QFileDialog(const QFileDialogArgs &args) */ QFileDialog::~QFileDialog() { -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) Q_D(QFileDialog); d->saveSettings(); #endif @@ -2723,7 +2725,7 @@ void QFileDialog::accept() } } -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) void QFileDialogPrivate::saveSettings() { Q_Q(QFileDialog); @@ -2781,7 +2783,7 @@ bool QFileDialogPrivate::restoreFromSettings() return restoreWidgetState(history, settings.value(QLatin1String("sidebarWidth"), -1).toInt()); } -#endif // QT_NO_SETTINGS +#endif // settings bool QFileDialogPrivate::restoreWidgetState(QStringList &history, int splitterPosition) { @@ -2854,7 +2856,7 @@ void QFileDialogPrivate::init(const QUrl &directory, const QString &nameFilter, else q->selectUrl(directory); -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) // Try to restore from the FileDialog settings group; if it fails, fall back // to the pre-5.5 QByteArray serialized settings. if (!restoreFromSettings()) { @@ -3019,7 +3021,7 @@ void QFileDialogPrivate::createWidgets() createToolButtons(); createMenuActions(); -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) // Try to restore from the FileDialog settings group; if it fails, fall back // to the pre-5.5 QByteArray serialized settings. if (!restoreFromSettings()) { diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index 17290381d3..447be19df1 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -187,7 +187,7 @@ public: #endif } -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) void saveSettings(); bool restoreFromSettings(); #endif diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 488ca6cbfd..557304e94f 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -113,7 +113,7 @@ public: bool tryCloseAllWindows() override; #if 0 // Used to be included in Qt4 for Q_WS_X11 -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) static bool x11_apply_settings(); #endif static void reset_instance_pointer(); diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 735ae6b080..8b7eb15577 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -102,7 +102,9 @@ #endif #include #include +#if QT_CONFIG(settings) #include +#endif #include #include #if QT_CONFIG(animation) diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index 3c93fd5e1f..eee2c0e30d 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -65,6 +65,9 @@ win32:!qtConfig(private_tests): SUBDIRS -= \ qprocess \ qprocess-noapplication +!qtConfig(settings): SUBDIRS -= \ + qsettings + winrt: SUBDIRS -= \ qstorageinfo