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
Change-Id: I8622dfe95bef13b196a3e38025fac1cc92f097c9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 30cf6ed32f
)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
0af9bb58e1
commit
596c9a71fa
@ -4393,6 +4393,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