QGenericUnixTheme: Fix build w/o xcb and wayland

Add ifdef condition to consider QKdeTheme only if Qt is built either
with wayland or xcb.

Fixes: QTBUG-135204
Change-Id: I27941bf6bd576c1532ac23992c1c94f9ace53683
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
This commit is contained in:
Axel Spoerl 2025-03-26 12:54:05 +01:00
parent 34be5083bd
commit c04b95cb59

View File

@ -161,11 +161,12 @@ QStringList QGenericUnixTheme::themeNames()
<< "LXDE";
const QList<QByteArray> desktopNames = desktopEnvironment.split(':');
for (const QByteArray &desktopName : desktopNames) {
#if !defined QT_NO_DBUS && QT_CONFIG(settings) && (QT_CONFIG(xcb) || QT_CONFIG(wayland))
if (desktopEnvironment == "KDE") {
#if !defined QT_NO_DBUS && QT_CONFIG(settings)
result.push_back(QLatin1StringView(QKdeTheme::name));
} else
#endif
} else if (gtkBasedEnvironments.contains(desktopName)) {
if (gtkBasedEnvironments.contains(desktopName)) {
// prefer the GTK3 theme implementation with native dialogs etc.
result.push_back(QStringLiteral("gtk3"));
// fallback to the generic Gnome theme if loading the GTK3 theme fails
@ -190,7 +191,7 @@ QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name)
{
if (name == QLatin1StringView(QGenericUnixTheme::name))
return new QGenericUnixTheme;
#if !defined QT_NO_DBUS && QT_CONFIG(settings)
#if !defined QT_NO_DBUS && QT_CONFIG(settings) && (QT_CONFIG(xcb) || QT_CONFIG(wayland))
if (name == QLatin1StringView(QKdeTheme::name))
return QKdeTheme::createKdeTheme();
#endif