summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-03-03 17:23:30 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-10 17:11:10 +0000
commit347b35a4466c10286fe8dab270d6b9f3fbcb6a46 (patch)
treea37480bfdf110980fd26aa8130d8df59b12b6c86
parent7ebcab3b5d1884f0c9c1771a628f03d6a0b39803 (diff)
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.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> (cherry picked from commit da59bc3434551b8a84ac643de3c18604d88338c6)
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 1ba8aa7c5f..d655b1006f 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4391,11 +4391,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);