How to change defualt color of QCheckbox box?
I want to change the default color of QCheckbox box (base ).
I have tried with
QPalette p;
p.setColor(QPalette::Base, QColor(255,0,0));
qCheckBox.setPalette(pal);
The above code works in Qt 4.3.3 with Qt3Support
Please guide me how to implement for Qt 4.4
Re: How to change defualt color of QCheckbox box?
For QCheckbox you need to use the QPalette::Button role as background. You can set the color roles by:
setBackgroundRole (QPalette::Button);
setForegroundRole (QPalette::ButtonText);
and use them by:
pal.setColor (backgroundRole(), background_color);
Re: How to change defualt color of QCheckbox box?
have a look at style sheets: stylesheet
Re: How to change defualt color of QCheckbox box?
Hi,
To set the user-defined colors in the base of QCheckBox, I have to set the style as
qCheckBoxObj->setStyle(new QWindowStyle);
And also,
QPalette p;
p.setColor(QPalette::Base, QColor(255,0,0));
qCheckBox.setPalette(pal);
The color is seen in my case.
Thanks for your replies......