Description of problem: When running non-KDE Qt applications outside of KDE, instead of using the default KDE style (like KDE applications do), they instead use an ugly "Windows" style. Version-Release number of selected component (if applicable): Fedora 17, Qt 4.8.1, KDE 4.8.3 How reproducible: very Steps to Reproduce: 1. Install Fedora 17 KDE spin 2. yum install openbox qt-config 3. Start an OpenBox session 4. Run qtconfig-qt4 Actual results: The Qt Config window's widget style is ugly. Notice that "Oxygen" is not that in the GUI Style dropdown. (KDE applications will use the default Oxygen style, however.) Expected results: Run: $ QT_PLUGIN_PATH=/usr/lib64/kde4/plugins qtconfig-qt4 Now the style is still set to "Desktop Settings (Default)", but it's using the Oxygen style. The Oxygen theme is also listed in the dropdown. Additional info: Gentoo solves it by adding a QT_PLUGIN_PATH entry to the global environment when KDE is installed: $ grep -r ^QT_PLUGIN_PATH /etc/env.d/ /etc/env.d/77kde:QT_PLUGIN_PATH=/usr/lib64/kde4/plugins OpenSuSE does it somehow differently, without setting QT_PLUGIN_PATH. Outside of KDE, the default style is "Plastique" for both KDE and non-KDE applications (and Oxygen is in qtconfig's dropdown).
We purposely do it this way now. We used to unconditionally set QT_PLUGIN_PATH via various methods even outside of kde, but that ended up with bad side-effects in some situations.
For some background, see bug #704840 , similar to this.
I read the linked bug, but I don't understand the problem - what are the "bad side-effects"? If KDE already sets QT_PLUGIN_PATH, why is it a problem outside of it? $ echo $QT_PLUGIN_PATH /home/alec/.kde/lib64/kde4/plugins/:/usr/lib64/kde4/plugins/:/usr/lib/kde4/plugins
One of the bad side effects was that the kde platform plugin would load unconditionally.
Normally, you're expected to use the GTK+ (QGtkStyle) style outside of KDE, not the Oxygen style.
One side-effect I recall was that kde4 platform loading in non-kde sessions, and testing just now on f17 with gnome shell, pure qt applications behave the same whether or not I set export QT_PLUGINS_PATH=/usr/lib64/kde4/plugins so I'm tempted to conclude that issue is no longer a problem. Anyone remember other reasons? If not, perhaps we can consider re-enabling this.
imo we should move this following codes from startkde into /etc/profile.d/kde.sh # Set the path for Qt plugins provided by KDE QT_PLUGIN_PATH=${QT_PLUGIN_PATH+$QT_PLUGIN_PATH:}`kde4-config --path qtplugins` # hack in multilib support if ! echo ${QT_PLUGIN_PATH} | /bin/grep -q /usr/lib/kde4/plugins ; then QT_PLUGIN_PATH=${QT_PLUGIN_PATH}:/usr/lib/kde4/plugins fi export QT_PLUGIN_PATH this change will allow qt apps to use kde styles outside/inside KDE.
We used to do that, but running kde4-config like that slowed down non-kde logins by several seconds, so that approach was reverted. We then opted to patch code
See bug #498809
Here's a link to the qt patch we'd used for awhile, it should still work (may need to be rediffed against current sources): https://bugzilla.redhat.com/attachment.cgi?id=342703&action=diff
(sorry for the spam), so that qt patch along with a kde.sh snippet for *just* multilib (ie, with no kde4-config call): # hack in multilib support if ! echo ${QT_PLUGIN_PATH} | /bin/grep -q /usr/lib/kde4/plugins ; then QT_PLUGIN_PATH=${QT_PLUGIN_PATH}:/usr/lib/kde4/plugins fi export QT_PLUGIN_PATH should then get us all that we want (I think)
So... can this be fixed then? :)
koji build: http://koji.fedoraproject.org/koji/buildinfo?buildID=319247 %changelog * Wed May 16 2012 Rex Dieter <rdieter> 4.8-14 - Pure Qt applications can't use KDE styles outside of KDE (#821062) Try it out, I'll work to submit this to updates shortly.
I've tested it, and it works great. Unfortunately, in the process I learned what you mean by "kde4 platform loading" - if I open a file dialog, it starts 4 KDE processes :(
I didn't experience that in my own testing. Which app(s) did you use as test cases? When you mentoined other distros have this "feature", did they also have this same side-effect?
I opened Qt Configuration, and on hit "Browse..." on the bottom of the "Printers" tab, and it resulted in the KDE-style browse dialog (rather than the plain one). There is a possibility that it's due to something I did... I'll try a clean install in a VM when I have time.
Setting the style to Oxygen will make Oxygen load into all Qt processes, which in turn loads KDE libraries, which in turn override the dialogs. This is more or less expected. (I assume Rex only set the plugin path, which by itself won't cause this effect (or at least shouldn't), not set the style to Oxygen, right Rex?)
I tested in gnome3 and xfce manually setting plugin path prior to running a handful of qt only apps
Kevin is right - if the theme is not Oxygen, KDE processes are not started. However, Oxygen does become the "Desktop Settings (Default)" theme, in an Openbox session with the KDE Spin. Certainly *I* don't have a problem with that - I think that's great. I'm just laying out the facts so that no one is surprised a week or two later :)
marking as fixed. with all the caveats mentioned in the last few comments.