how to change QCheckBox text label color in Qt?

sai picture sai · Jun 22, 2012 · Viewed 16.5k times · Source

I'm unable to change the color of Qcheckbox in QT, can somebody help me with code to change color of check box text label. I have tried Qpalette.. And im using QT4.7.4 version..

Answer

pnezis picture pnezis · Jun 22, 2012

You could use stylesheets.

e.g:

checkBox->setStyleSheet("QCheckBox { color: red }");

For more details check the style sheets in Qt Reference and the stylesheets documentation