Disabling the QGroupBox title
Given the QGroupBox by calling its member function, "setEnabled (false)" will be grayed out and disabled its contents.
However, how do I gray out the title of the window? Presumably there is some style-related workaround that I could use if there isn't a simple method somewhere. If so, which is easiest?
+3
source to share
1 answer
What you need to set is this color
sub-control property title
:
groupBox->setStyleSheet("QGroupBox::title{ color: gray }")
EDIT
You can also achieve the same effect by using QPalette
, without using styles
// Create a palette
QPalette palette;
palette.setColor(QPalette::Disabled, QPalette::WindowText,
QApplication::palette().color(QPalette::Disabled, QPalette::WindowText));
groupBox->setPalette(palette);
+3
source to share