To change the style of your application, you should use QApplication.setSyle
, then you have a consistent style in your whole GUI.
Setting a QWidgets's style only sets the style for the widget itself.
Sets the widget's GUI style to style. The ownership of the style object is not transferred.
If no style is set, the widget uses the application's style, QApplication.style() instead.
Setting a widget's style has no effect on existing or future child widgets.
Warning: This function is particularly useful for demonstration purposes, where you want to show Qt's styling capabilities. Real applications should avoid it and use one consistent GUI style instead.
That means if you want to change the style of a widget and all it's children, you need to explicitly set it for all children by iterating through them:
cleanlooks = QStyleFactory.create('cleanlooks')
msgbox.setStyle(cleanlooks)
for child in msgbox.findChildren(QWidget):
child.setStyle(cleanlooks)