From 4710fb3528873e630b6b1e34c947a1c811e0e854 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 8 May 2023 16:47:00 +0200 Subject: [PATCH] QIconLoader: use system fallback theme as the first fallback option When searching for an icon, we either use the system theme or the theme set as a fallback through QPlatformTheme, it's only one or the other. It can easily happen that the fallback theme we pick as a parent theme will not fit into the application style (color-wise). For example using KDE apps on GNOME, where we use "Adwaita" icon theme, we would always fallback to "Breeze", however, using dark theming, we want to fallback to "Breeze-dark" and this can be easily set through QPlatformTheme integration, but it's not going to be used when the system icon theme is valid and in such case the fallback theme will be ignored. This change makes the system fallback theme used as the default fallback by putting it to the list of parent themes. Pick-to: 6.5 6.2 5.15 Change-Id: I966cd8ddd0e5576e3593d349fe7ee7139136bfdf Reviewed-by: Axel Spoerl --- src/gui/image/qiconloader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 92bb5e65db0..5a0b421b03e 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -384,6 +384,10 @@ QIconTheme::QIconTheme(const QString &themeName) m_parents.append(fallback); } + // Use system fallback theme as the first fallback option + if (const QString &systemFallback = systemFallbackThemeName(); !systemFallback.isEmpty()) + m_parents.prepend(systemFallback); + // Ensure that all themes fall back to hicolor if (!m_parents.contains("hicolor"_L1)) m_parents.append("hicolor"_L1);