Fix QPushButton style sheet style for overlay (content) image

Unlike comparable widgets like QLabel or QFrame, QPushButton would not
render a content image specified in the stylesheet, unless a border
style was also specified. Fix by explicitly rendering the content
image, if set, in the native-border codepath also.

Although the doc warns about the QPushButton border style having to be
set in order for the background styling to take effect (since the
native border painting otherwise hides it), the previous behavior does
seem unexpected.

Fixes: QTBUG-72029
Change-Id: I8b979b010515dab4dcf2f00344a187c87eeec096
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
Eirik Aavitsland 2019-12-03 13:39:08 +01:00
parent f16bd40189
commit 03dc30acca

View File

@ -3493,6 +3493,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
} else {
QWindowsStyle::drawControl(ce, &btnOpt, p, w);
}
rule.drawImage(p, rule.contentsRect(opt->rect));
if (!customMenu)
return;
} else {