I installed Qt5 along with Qt4 on my Kubuntu 12.10 linux machine and noticed the following:
- Program compiled with Qt4 has native KDE look and feel. I use default KDE's Oxygen theme and so does my program (note smooth gradient with title and blue selection of focused widget);
- But when recompiled with Qt5 without any changes to code, it uses different style (seems like it is called Fusion) and it looks awkward and out-of-place (see right pic)
What I want is pretty straitforward: I want my app to fit surrounding system, i.e. look native always. When using Qt4, I'm used to having this by default. Qt5 also seemed to have normal native look in Windows. But what do I have to do to have the same in Kubuntu as well? And, ideally, everywhere? I mean, I do not want to force linux build of my app to strictly use Oxygen. I want it to use the theme that is currently set in KDE: just like it was in good old Qt4.
It seems like app code is not relevant to this issue: I didn't play with any QStyle's in it, it's pretty much typical Qt's hello-world. But just in case it's on GitHub.
UPD: @peppe has given pretty sufficient answer on why this problem happens (Oxygen theme in KDE is compiled against Qt4 and not usable by Qt5). But I'm still looking for the answer on how to fix this? I tried to find Oxygen theme source to play around with, but didn't find anything except Firefox theme.
UPD2: @kwirz suggested an interesting idea: force the app to use GTK+ theme, and enable oxygen-gtk in KDE settings that makes GTK windows look similar to Oxygen. On the one hand, it indeed looks closer to Oxygen:
But on the other hand, we already see the little differences: readonly line edit turns gray, focused button is still not hightlighted, etc. Unfortunately, when trying to apply this technique to more complex widgets, even more artifacts appear (especially on combo box and spinner):
So it seems like this techique cannot be a complete solution, but still very useful is simple cases.