Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.9.2, 5.12.0
-
None
Description
I thought that when starting Qt 5 applications in a Gtk based desktop environment, they were supposed to emulate the desktop look and feel by loading a Qt style with the same name as the global Gtk theme, if available. This does not appear to be the case when I run under MATE, however - instead, the program will look for a "static" list of styles; something like { "fusion", "windows" }.
Based on source code inspection, it looks like the problem is that platform plugin 'gtk3' simply doesn't check the gtk-theme-name setting, or handle the theme hint QPlatformTheme::StyleNames in any other way - a request for the hint data will just revert to a fall-back from a general base class. This suggests that you will get the same problem with desktops like GNOME, XFCE, LCDE and Cinnamon. On GNOME 3, you can get around the issue by using a 3rd party plugin from https://github.com/FedoraQt/QGnomePlatform, but it will get the theme directly from GNOME specific "dconf" keys, and is thus not suitable for the other desktops mentioned, with the possible exception of Cinnamon.
The problem may be solved by adding the following case to switch statement in QGtk3Theme::themeHint(), file src/plugins/platformthemes/gtk3/qgtk3theme.cpp
case QPlatformTheme::StyleNames: { QVariant v = QGnomeTheme::themeHint(hint); QString gtkTheme=gtkSetting("gtk-theme-name"); if (!gtkTheme.isEmpty()) { QStringList styleNames; styleNames << gtkTheme << v.toStringList(); v.setValue(styleNames); } return v; }
Note: I encountered this issue on system with a Qt 5.9.2, but tried replacing the plugin with a version I built from Qt 5.12 sources, and that did not resolve the problem.