From 1ac58f4ba343d0de74cfc879a13a751bcb49c316 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 3 Mar 2024 17:23:30 +0100 Subject: 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.7 6.6 6.5 Task-number: QTBUG-102820 Fixes: QTBUG-122821 Fixes: QTBUG-122825 Change-Id: I1b5b8d70d66475bbfa4a40652dc3fdd4cc670c32 Reviewed-by: Volker Hilsheimer --- src/widgets/styles/qstylesheetstyle.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index fcbe9ae613..471d7ffe9c 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -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); -- cgit v1.2.3