From ff168e345f180cce1ad91bf1f4d216b796628b3b Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Tue, 23 Jul 2024 19:26:14 +0100 Subject: [PATCH 1/2] Remove icon ThemeSearchPaths option on Linux ThemeSearchPaths option was originally introduced in: c420de0f9b ("Option to opt-out from using a Linux desktop icon theme.", 2020-01-26) It was set on by default in: dc6456caf9 ("Gui: Use FreeCAD supplied icons on Linux by default", 2024-06-26) The key effect of the option is to select the FreeCAD-default icon theme. The code also unnecessarily resets QIcon::themeSearchPaths, ":\icons" is always included in the default search paths [1], when when using QAdwaitaDecorations causes window frame control icons not to be displayed: (qt.qpa.qadwaitadecorations) Failed to find an svg icon for "window-close-symbolic.svg" (qt.qpa.qadwaitadecorations) Failed to find an svg icon for "window-minimize-symbolic.svg" (qt.qpa.qadwaitadecorations) Failed to find an svg icon for "window-maximize-symbolic.svg" (qt.qpa.qadwaitadecorations) Failed to find an svg icon for "window-restore-symbolic.svg" A different default icon theme can still be chosen with the Name option. [1] https://doc.qt.io/qt-6/qicon.html#themeSearchPaths --- src/Gui/StartupProcess.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/Gui/StartupProcess.cpp b/src/Gui/StartupProcess.cpp index f1b627e6d9..8ff699640b 100644 --- a/src/Gui/StartupProcess.cpp +++ b/src/Gui/StartupProcess.cpp @@ -163,24 +163,14 @@ void StartupProcess::registerEventType() void StartupProcess::setThemePaths() { - ParameterGrp::handle hTheme = App::GetApplication().GetParameterGroupByPath( - "User parameter:BaseApp/Preferences/Bitmaps/Theme"); #if !defined(Q_OS_LINUX) QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << QString::fromLatin1(":/icons/FreeCAD-default")); - QIcon::setThemeName(QLatin1String("FreeCAD-default")); -#else - // Option to opt-in into using a Linux desktop icon theme. - // https://forum.freecad.org/viewtopic.php?f=4&t=35624 - bool themePaths = hTheme->GetBool("ThemeSearchPaths", false); - if (!themePaths) { - QStringList searchPaths; - searchPaths.prepend(QString::fromUtf8(":/icons")); - QIcon::setThemeSearchPaths(searchPaths); - QIcon::setThemeName(QLatin1String("FreeCAD-default")); - } #endif + ParameterGrp::handle hTheme = App::GetApplication().GetParameterGroupByPath( + "User parameter:BaseApp/Preferences/Bitmaps/Theme"); + std::string searchpath = hTheme->GetASCII("SearchPath"); if (!searchpath.empty()) { QStringList searchPaths = QIcon::themeSearchPaths(); @@ -189,7 +179,9 @@ void StartupProcess::setThemePaths() } std::string name = hTheme->GetASCII("Name"); - if (!name.empty()) { + if (name.empty()) { + QIcon::setThemeName(QLatin1String("FreeCAD-default")); + } else { QIcon::setThemeName(QString::fromLatin1(name.c_str())); } } From 598fa20b03278ba10cf44f5e9898da69cee1bf80 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Thu, 25 Jul 2024 19:21:25 +0100 Subject: [PATCH 2/2] Copy current icon theme name to the fallback on startup --- src/Gui/StartupProcess.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Gui/StartupProcess.cpp b/src/Gui/StartupProcess.cpp index 8ff699640b..356d4dd04a 100644 --- a/src/Gui/StartupProcess.cpp +++ b/src/Gui/StartupProcess.cpp @@ -178,6 +178,9 @@ void StartupProcess::setThemePaths() QIcon::setThemeSearchPaths(searchPaths); } + // KDE file dialog needs icons from the desktop theme + QIcon::setFallbackThemeName(QIcon::themeName()); + std::string name = hTheme->GetASCII("Name"); if (name.empty()) { QIcon::setThemeName(QLatin1String("FreeCAD-default"));