diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp index 58b613baeb2..2b3fb2b9494 100644 --- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp +++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp @@ -84,28 +84,19 @@ QXdgDesktopPortalTheme::QXdgDesktopPortalTheme() { Q_D(QXdgDesktopPortalTheme); - QStringList themeNames; - themeNames += QGuiApplicationPrivate::platform_integration->themeNames(); - // 1) Look for a theme plugin. - for (const QString &themeName : std::as_const(themeNames)) { + const QStringList themeNames = QGuiApplicationPrivate::platform_integration->themeNames(); + for (const QString &themeName : themeNames) { if (QXdgDesktopPortalTheme::isXdgPlugin(themeName)) continue; + // 1) Look for a theme plugin. d->baseTheme = QPlatformThemeFactory::create(themeName, nullptr); if (d->baseTheme) break; - } - // 2) If no theme plugin was found ask the platform integration to - // create a theme - if (!d->baseTheme) { - for (const QString &themeName : std::as_const(themeNames)) { - if (QXdgDesktopPortalTheme::isXdgPlugin(themeName)) - continue; - d->baseTheme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName); - if (d->baseTheme) - break; - } - // No error message; not having a theme plugin is allowed. + // 2) If no theme plugin was found ask the platform integration to create a theme + d->baseTheme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName); + if (d->baseTheme) + break; } // 3) Fall back on the built-in "null" platform theme.