How can I make a Qt widget ignore style sheets set on parent widgets?
Posted
by Hisham Abboud
on Stack Overflow
See other posts from Stack Overflow
or by Hisham Abboud
Published on 2010-05-14T22:49:56Z
Indexed on
2010/05/14
22:54 UTC
Read the original article
Hit count: 487
qt
When adding a QComboBox control in Qt Designer, I get a terrible looking, non-native control, see:
http://curiouschap.com/wp-content/uploads/2010/05/stack_qcombobox_question.png [as a newbie, SO wouldn't let me insert the image]
On digging further, it turns out that two of the parent controls, QParentWindow and QStackedWidget, have style sheets that QComboBox is inheriting. If I delete the custom styles, then I get a native QComboBox like the one on the left.
How can I have QComboBox (and widgets generally) NOT inherit parent styles? Or, how can I create a style for, say, QParentWindow, and do it so that it's local only and does not cascade?
© Stack Overflow or respective owner