Don't double draw ItemViewItems' icons in QStyleSheetStyle::drawControl
To draw a CE_ItemViewItem QStyleSheetStyle::drawControl lets parts of the element being drawn by QWindowsStyle, others by baseStyle(). If the ItemViewItem has an icon, it can lead to the icon being drawn twice: Once by QWindowsStyle, respecting options set in the stylesheet. Once by the baseStyle(), not respecting stylesheet options. When the style sheet modifies the icon's position, the icon will be drawn at this position as well as on the default position. This patch prevents an icon to be drawn by baseStyle() when it has already been drawn by the QWindowsStyle. Fixes: QTBUG-110942 Pick-to: 6.6 6.5 Change-Id: I8622dfe95bef13b196a3e38025fac1cc92f097c9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
9d8a04cd1f
commit
30cf6ed32f
@ -4383,6 +4383,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
|
||||
optIndicator.backgroundBrush = Qt::NoBrush; // no background
|
||||
optIndicator.text.clear();
|
||||
QWindowsStyle::drawControl(ce, &optIndicator, p, w);
|
||||
|
||||
// If the indicator has an icon, it has been drawn now.
|
||||
// => don't draw it again.
|
||||
optCopy.icon = QIcon();
|
||||
|
||||
// Now draw text, background, and highlight, but not the indicator with the
|
||||
// base style. Since we can't turn off HasCheckIndicator to prevent the base
|
||||
// style from drawing the check indicator again (it would change how the item
|
||||
|
Loading…
Reference in New Issue
Block a user