I am using stylesheets. I want to set style information for the main message text and the informative text for a QMessageBox. Is it possible to access these sub-controls ?
Yes it is possible. The trick is to know how to select the sub-controls. Here's how you can change the style of the text, in this example I make the dialog grey and the text off-white:
QMessageBox {
background-color: #333333;
}
QMessageBox QLabel {
color: #aaa;
}
The second clause uses a Descendant Selector which in this case means "any QLabel that is a descendant of a QMessageBox including children and grandchildren etc". You can be more specific and only select children with QMessageBox > QLabel
I found this information here http://qt-project.org/doc/qt-4.8/stylesheet-syntax.html
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