QStyleSheetStyle: don't draw check indicator twice

When the styled check indicator is smaller than the one from the base
style, then the clip region was to small and the check indicator from
the base style was also drawn. Therefore add both check rects to the
clipRegion.

Pick-to: 6.6 6.5
Task-number: QTBUG-102820
Fixes: QTBUG-122821
Fixes: QTBUG-122825
Change-Id: I1b5b8d70d66475bbfa4a40652dc3fdd4cc670c32
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1ac58f4ba343d0de74cfc879a13a751bcb49c316)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2024-03-03 17:23:30 +01:00 committed by Qt Cherry-pick Bot
parent d100f591f1
commit da59bc3434

View File

@ -4393,11 +4393,13 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
// 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
// gets laid out) we have to clip the indicator that's already been painted.
const QRect checkRect = subElementRect(QStyle::SE_ItemViewItemCheckIndicator,
&optIndicator, w);
const QRect crStyle = subElementRect(QStyle::SE_ItemViewItemCheckIndicator,
&optIndicator, w);
const QRect crBase = baseStyle()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator,
&optIndicator, w);
const QRegion clipRegion = QRegion(p->hasClipping() ? p->clipRegion()
: QRegion(optIndicator.rect))
- checkRect;
- crStyle.united(crBase);
p->setClipRegion(clipRegion);
}
subRule.configurePalette(&optCopy.palette, QPalette::Text, QPalette::NoRole);