Bug 1002900

Summary: Qt5 doesn't obey GTK+ theming, possibly missing qtstyleplugins
Product: [openSUSE] openSUSE Tumbleweed Reporter: S. B. <sb56637>
Component: KDE ApplicationsAssignee: Alexei Sorokin <sor.alexei>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: forgotten_DV81ZEWZkN
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: ~/.config/qt5ct for regular user accounts
/root/.config/qt5ct also needs to be in place for themed YaST2
I prefer the color definitions to be in a common /usr/share/qt5ct location

Description S. B. 2016-10-04 21:43:50 UTC
Hello, with the upgrade to QT 5.7.0 my QT5 apps no longer obey the GTK theme. I always used to use `QT_STYLE_OVERRIDE=gtk` in my `/etc/environment` file, and it worked fine. Now it appears this might not be supported anymore, but openSUSE appears to be missing the `qtstyleplugins` that is now needed? These are the references I can find about the issue:

https://github.com/linuxmint/Cinnamon/issues/5440

https://wiki.archlinux.org/index.php/Qt#Qt5
> To force a specific style, you can set the QT_STYLE_OVERRIDE environment variable. Specifically, set it to gtk2 if you want to use the GTK+ theme (Note: you will need to install the Qt style plugins mention below to get the GTK+ style)

https://aur.archlinux.org/packages/qt5-styleplugins/
Comment 1 Forgotten User DV81ZEWZkN 2016-10-05 21:12:17 UTC
It is 'needed' for using gtk2 style, yes, as the style has been removed from official Qt base module. As you noticed maybe, for Arch the package is in AUR repo -> perfect example for someone to package it in OBS =)

I don't want to maintain it. Last, and only release (w/o gtk2 style) is 3 years old.
Comment 2 S. B. 2016-10-06 01:49:05 UTC
Hi Hrvoje, thanks for the reply, although that wasn't exactly the answer I wanted to hear. :-) So there's no more options to make QT5 apps look decent?
Comment 3 S. B. 2016-10-06 19:03:42 UTC
Alexei, could you please take a look at this? Would it be possible to apply Clem's patch so that Cinnamon doesn't force the now useless `QT_STYLE_OVERRIDE` variable?
https://github.com/linuxmint/Cinnamon/issues/5440#issuecomment-250939396
Comment 4 Forgotten User DV81ZEWZkN 2016-10-06 21:26:29 UTC
I haven't looked at the whole cinnamon-session/main.c, but the patch seems hammer-like. IMHO best solution in Qt-language would be e.g.
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
    if (qEnvironmentVariableIsEmpty("QT_STYLE_OVERRIDE")) {
       qputenv("QT_STYLE_OVERRIDE", QByteArray("gtk"));
    }
#endif
Comment 5 Alexei Sorokin 2016-10-09 17:55:08 UTC
I have some ideas about fixing this mess.
Might take a while sorting it all out though.
Comment 6 S. B. 2016-10-09 21:42:31 UTC
Hi Alexei, thanks a lot for taking a look. This is indeed a mess, but caused by the Qt project.

Meanwhile, I am using the `qt5ct` package with the Fusion theme and a color scheme that approximately matches what my GTK theme has. I am attaching it for reference. This makes my system somewhat more bearable to use for now.
Comment 7 S. B. 2016-10-09 21:43:17 UTC
Created attachment 696586 [details]
~/.config/qt5ct for regular user accounts
Comment 8 S. B. 2016-10-09 21:44:04 UTC
Created attachment 696587 [details]
/root/.config/qt5ct also needs to be in place for themed YaST2
Comment 9 S. B. 2016-10-09 21:44:58 UTC
Created attachment 696588 [details]
I prefer the color definitions to be in a common /usr/share/qt5ct location
Comment 10 Alexei Sorokin 2016-10-21 12:13:39 UTC
I've created https://build.opensuse.org/request/show/436689 to make sure everybody gets libqt5-qtstyleplugins-platformtheme-gtk2 finally solving this issue :-).
Comment 11 S. B. 2016-10-24 11:43:55 UTC
Well done Alexei, thanks a lot!
Comment 12 Bernhard Wiedemann 2017-10-28 16:01:17 UTC
This is an autogenerated message for OBS integration:
This bug (1002900) was mentioned in
https://build.opensuse.org/request/show/537327 Factory / libqt5-qtbase