Given a QGroupBox, calling its member function, "setEnabled(false)" will grey out and disable its contents.
However, how do I grey out the title of the box? Presumably there's some workaround involving styles that I could use if there isn't a simple method somewhere. If so, what is the easiest?
What you need to set is the color
property of the title
sub-control:
groupBox->setStyleSheet("QGroupBox::title{ color: gray }")
EDIT
You could also achieve the same effect using QPalette
, without the use of stylesheets
// Create a palette
QPalette palette;
palette.setColor(QPalette::Disabled, QPalette::WindowText,
QApplication::palette().color(QPalette::Disabled, QPalette::WindowText));
groupBox->setPalette(palette);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With