Remove double negation ifdefs in QKdeTheme

Replace ifndef QT_NO_DBUS antipattern by if QT_CONFIG(dbus).

Change-Id: I186c779f3c4ed36a1fb082993e792e9c28ee20f0
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
This commit is contained in:
Axel Spoerl 2025-04-04 09:20:18 +02:00
parent fa42c281ee
commit 2bbf6aa2b8
2 changed files with 10 additions and 10 deletions

View File

@ -109,18 +109,18 @@ public:
private: private:
mutable QHash<QString, QSettings *> kdeSettings; mutable QHash<QString, QSettings *> kdeSettings;
#ifndef QT_NO_DBUS #if QT_CONFIG(dbus)
std::unique_ptr<QDBusListener> dbus; std::unique_ptr<QDBusListener> dbus;
bool initDbus(); bool initDbus();
void settingChangedHandler(QDBusListener::Provider provider, void settingChangedHandler(QDBusListener::Provider provider,
QDBusListener::Setting setting, QDBusListener::Setting setting,
const QVariant &value); const QVariant &value);
Qt::ColorScheme colorSchemeFromPalette() const; Qt::ColorScheme colorSchemeFromPalette() const;
#endif // QT_NO_DBUS #endif // QT_CONFIG(dbus)
void clearResources(); void clearResources();
}; };
#ifndef QT_NO_DBUS #if QT_CONFIG(dbus)
void QKdeThemePrivate::settingChangedHandler(QDBusListener::Provider provider, void QKdeThemePrivate::settingChangedHandler(QDBusListener::Provider provider,
QDBusListener::Setting setting, QDBusListener::Setting setting,
const QVariant &value) const QVariant &value)
@ -166,15 +166,15 @@ bool QKdeThemePrivate::initDbus()
return QObject::connect(dbus.get(), &QDBusListener::settingChanged, dbus.get(), wrapper); return QObject::connect(dbus.get(), &QDBusListener::settingChanged, dbus.get(), wrapper);
} }
#endif // QT_NO_DBUS #endif // QT_CONFIG(dbus)
QKdeThemePrivate::QKdeThemePrivate(const QStringList &kdeDirs, int kdeVersion) QKdeThemePrivate::QKdeThemePrivate(const QStringList &kdeDirs, int kdeVersion)
: kdeDirs(kdeDirs), kdeVersion(kdeVersion) : kdeDirs(kdeDirs), kdeVersion(kdeVersion)
{ {
std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(nullptr)); std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(nullptr));
#ifndef QT_NO_DBUS #if QT_CONFIG(dbus)
initDbus(); initDbus();
#endif // QT_NO_DBUS #endif // QT_CONFIG(dbus)
} }
static constexpr QLatin1StringView settingsPrefix(QKdeThemePrivate::KdeSettingType type) static constexpr QLatin1StringView settingsPrefix(QKdeThemePrivate::KdeSettingType type)
@ -812,7 +812,7 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
return new QKdeTheme(kdeDirs, kdeVersion); return new QKdeTheme(kdeDirs, kdeVersion);
} }
#ifndef QT_NO_DBUS #if QT_CONFIG(dbus)
QPlatformMenuBar *QKdeTheme::createPlatformMenuBar() const QPlatformMenuBar *QKdeTheme::createPlatformMenuBar() const
{ {
if (isDBusGlobalMenuAvailable()) if (isDBusGlobalMenuAvailable())
@ -821,7 +821,7 @@ QPlatformMenuBar *QKdeTheme::createPlatformMenuBar() const
} }
#endif #endif
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) #if QT_CONFIG(dbus) && QT_CONFIG(systemtrayicon)
QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const
{ {
if (shouldUseDBusTray()) if (shouldUseDBusTray())

View File

@ -43,10 +43,10 @@ public:
void requestColorScheme(Qt::ColorScheme scheme) override; void requestColorScheme(Qt::ColorScheme scheme) override;
const QFont *font(Font type) const override; const QFont *font(Font type) const override;
#ifndef QT_NO_DBUS #if QT_CONFIG(dbus)
QPlatformMenuBar *createPlatformMenuBar() const override; QPlatformMenuBar *createPlatformMenuBar() const override;
#endif #endif
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) #if QT_CONFIG(dbus) && QT_CONFIG(systemtrayicon)
QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
#endif #endif