View Full Version : KDE 3 style applied to Qt 4 programs

10th December 2007, 23:25
Is there an easy way to 'force' the KDE 3 style chosen for my desktop to Qt 4 programs? It doesn't bother me to write some (not too much) code in my program to make it look like the rest of the programs.

(I have to some GTK+ stuff for school and the Gtk/Qt engine got me by surprize, my GTK+ 2 program had the KDE style buttons :p )

11th December 2007, 00:20
No, it's not possible. Qt3 and Qt4 style API differs very much. But you should be able to force a KDE4 style on a Qt4 app.

22nd July 2008, 22:52
There is no way around it - you can't style Qt4 apps with Qt3 styles without rewriting them for Qt4.

28th November 2008, 23:23
Ok, my question is the other way round: is there a way to not force KDE3 settings on Qt4 apps? Why I'm asking is: I'm (still) using KDE3 (with the Baghira style) and some Qt4 apps. Those apps seem to take up the color theme from the KDE3 style, which in the end doesn't look very good on Qt4 because, frankly, this theme is waaaay too configurable, and I (of course) use this to an excessive amount to make it look like my preferred GUI ;) But with any other style the color choice looks very odd.

I would expect other KDE3 styles to adopt these color settings, but I was really surprised that Qt4 also adopts them. Now, admittedly, this might be a positive thing for most people, but for my use case it results in some plain ugly GUIs... So I'm wondering, is there a way to keep Qt4 from using KDE3's style settings (be it colors or whatever...)?

4th December 2008, 21:24
I'm gonna answer myself here. I finally discovered QApplication::setDesktopSettingsAware, which probably gets as close to solve the above mentioned issue as possible. It prevents Qt from using any desktop specific settings, be it fonts, colors or the like.

The one thing to take notice of is that you have to set this before creating a QApplication instance, changing this setting afterwards doesn't have any effect.