PDA

View Full Version : Coloring checkable QPushbutton with style sheet



RThaden
16th July 2008, 14:58
Try the following:

Open the designer, pull a Pushbutton on an empty widget, make it checkable and give it the following style sheet


QPushButton {background-color: green;}
QPushButton:checked{background-color: red;}

This should make the unchecked button green and the checked button red.
However, what happens is:
It's green when unchecked
It's lightgray when checked
It's red whil you keep it pressed when it is in the checked state.

What am I missing. The documentation says "Checkable QPushButton have the :checked pseudo state set. "

I am using XP and Vista (happens in both) and Qt 4.3.2

Regards,

Rainer

jacek
25th July 2008, 18:11
What happens when you run your application with -style plastique option?