diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2024-03-03 17:23:30 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2024-03-09 13:52:20 +0100 |
commit | 1ac58f4ba343d0de74cfc879a13a751bcb49c316 (patch) | |
tree | a96a3f486d204aa7421ec3e28eae398b984f1a16 /src/widgets | |
parent | fde358dd9069d0695f113ec6ba98efebedd1e520 (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.7 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>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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); |