The bugreport has now been answered with a solution that's easier than @ekhumoro's answer and works:
I don't think this is valid. The paint code your are looking for is not drawn in the
paintEvent
. Look forQWidgetPrivate::paintBackground
instead. For performance reasons widgets will ignore style sheets by default, but you can set theWA_StyledBackground
attribute on the widget and it should respect style sheet backgrounds.
And indeed, doing this before setting the stylesheet does the trick:
self.setAttribute(Qt.WA_StyledBackground)