Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.9, 6.7
-
None
Description
The behavior of QWidget subclassing in QSS and that of Qt::WA_StyledBackground have similar result, but may be misleading and change depending on the situation.
First of all, Qt::WA_StyledBackground does not only style the background but also follows related rules, such as borders. The documentation does not mention that.
Then, most importantly, a widget that has the above flag set, always draws the background and borders, even if the paint event is ignored, which is unexpected: installing an event filter on a widget and ignoring a QEvent:Paint (eg, by returning true) event, or overriding paintEvent() and then doing nothing in it, will still result in the widget being painted with the QSS rule, with border and background being shown.
I may understand the reasoning behind all that, but the documentation should at least mention these aspects, both in the QSS reference and in the WidgetAttribute enum docs.