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

View File

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