PDA

View Full Version : Stylesheet on QComboBox.



jos
4th December 2010, 20:36
Dear group,

I'm using Qt for an open source project of mine (dlRaw).
Wonderful library, really.

I'm now stuck on something where the manuals and google are not able to help me.

I want to style a QComboBox and following small stylesheet snippet is giving me trouble :

QComboBox {
background-color : blue;
color : red;
}

I would assume that this puts the background of the combobox in blue and the 'arrow' and 'text' in red. On my 4.5.2 Qt (in Ubuntu 9.10) this is effectively what happens.

On my newer Ubuntu, featuring 4.7.0 the 'text' doesn't change color.
So I downloaded 4.7.1 (one never knows it is a bug ..) and also there the 'text' does not change color.

Has there been changes between 4.5.2 and now that require me to style the QComboBox in a different way ? I seem to be able to change nearly every aspect of the combobox, except for that text ... (which is of course in an impossible colour for my current theme ....

All help is much appreciated.

Jos

jos
5th December 2010, 10:08
Dear group,

Some additional information that sheds some different light on the subject.

I now 'downgraded' my other box , the one with the problem , to Qt 4.5.2 and I still have the same problem. Then I noticed that my original box - the one it works upon - has Xfce running as desktop, while my new box runs Gnome.

Now, if I turn the desktop to Xfce, it works as expected. If I run it in Gnome, it doesn't !

I'm now completely stuck ... It seems that the desktop is somehow taking over control of some of the elements ? Or what ? Can this be changed ?

Thanks for all help of hints,

Jos

P.S. I doubt if this still is a "newbie" question. So administrator, you might want to move the thread.

Added after 14 minutes:

Dear group,

My latest post worked quite as a therapy ;)

The answer to the question was somehow in the post : it's of course the "default style" that makes the difference. Running my application with -style plastique or -style motif ... makes the combobox respond correctly to the stylesheet.

I leave this one to the experts, but it appears to me that this can be classified as a bug that reveals itselfs under gtk-style.

Best regards,

Jos