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?


source to share

1 answer

What you need to set is this color

sub-control property title


groupBox->setStyleSheet("QGroupBox::title{ color: gray }")



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));




All Articles