Use a stylesheet
For all your widget:
ui->setStyleSheet(
"QCheckBox:checked {
{color: black;}
}
QCheckBox:unchecked {
{color: grey;}
}"
)
Edit:
As mentioned in comment, To make it work with custom themes, you can make the style querying the palette:
QPalette my_palette = ui->palette()
QColor my_active_color = my_palette.color(QPalette::Active, QPalette::Text);
QColor my_disabled_color = my_palette.color(QPalette::Disabled, QPalette::Text);
QString my_style =
QString("QCheckBox:checked { {color: rgb(%1, %2, %3);} } "
"QCheckBox:unchecked { {color: rgb(%4, %5, %6);}}")
.arg( my_active_color.red())
.arg( my_active_color.green())
.arg( my_active_color.blue() )
.arg( my_disabled_color.red())
.arg( my_disabled_color.green())
.arg( my_disabled_color.blue() );
ui->setStyleSheet(my_style);
Note that i dindn't tried it and it could have any typo, but you get the idea.