PDA

View Full Version : qCheckbox back ground color



sreedhar
20th December 2006, 16:17
Hi,
i set the qCheckbox coloring using setPalette(), but it changes the background color of text beside checkbox.
I want to change the color of the checkbox (the small box where we can check and uncheck the option) and not the text.

please provide any code snippet if possible

regards

ggrinder
20th December 2006, 18:44
The QPalette::Base role is responsible for the color of the box.

The following snippet would set it do blue.


QCheckBox cb ( "A CheckBox" );

QPalette p = cb.palette( );
QColor blue( 0, 0, 255 );
p.setColor( QPalette::Active, QPalette::Base, blue );
cb.setPalette( p );


See
http://doc.trolltech.com/4.2/qpalette.html#ColorRole-enum
This also should solve your QComboBox problem.