QStyleSheetStyle: Propagate CE_ItemViewItem drawing to baseStyle

Currently the drawing of CE_ItemViewItem is propagated to QWindowsStyle,
which leads to ignoring alternating rows in ItemViews. Propagating the
drawing to baseStyle honors the set base style.

Fixes: QTBUG-123632
Pick-to: 6.6 6.5
Change-Id: I656ee1c44029abf7233551303d469d38b6c848e3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f39f2bfe0b216252980c082b1771540dd00e6bd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Wladimir Leuschner 2024-03-28 13:18:59 +01:00 committed by Qt Cherry-pick Bot
parent 4444167c16
commit 6aedc439c6

View File

@ -4368,7 +4368,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (subRule.hasDrawable()) { if (subRule.hasDrawable()) {
subRule.configurePalette(&optCopy.palette, vopt->state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text, subRule.configurePalette(&optCopy.palette, vopt->state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text,
vopt->state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base); vopt->state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base);
QWindowsStyle::drawControl(ce, &optCopy, p, w); baseStyle()->drawControl(ce, &optCopy, p, w);
} else { } else {
p->save(); p->save();
if (hasStyleRule(w, PseudoElement_Indicator)) { if (hasStyleRule(w, PseudoElement_Indicator)) {
@ -4387,7 +4387,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
optIndicator.backgroundBrush = Qt::NoBrush; // no background optIndicator.backgroundBrush = Qt::NoBrush; // no background
optIndicator.text.clear(); optIndicator.text.clear();
optIndicator.icon = QIcon(); optIndicator.icon = QIcon();
QWindowsStyle::drawControl(ce, &optIndicator, p, w); baseStyle()->drawControl(ce, &optIndicator, p, w);
// Now draw text, background,icon, and highlight, but not the indicator with // Now draw text, background,icon, and highlight, but not the indicator with
// the base style. Since we can't turn off HasCheckIndicator to prevent the base // the base style. Since we can't turn off HasCheckIndicator to prevent the base