Use base style when drawing item view item with only indicator styled
The base style should still draw the item and the selection highlighting. Fixes: QTBUG-83619 Pick-to: 6.2 6.1 Change-Id: I1cd8c4fce48cb5543337415918fc99ffb5e19e00 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
7bb464554a
commit
1d48572b4e
@ -4281,15 +4281,19 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
|
|||||||
case CE_ItemViewItem:
|
case CE_ItemViewItem:
|
||||||
if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
|
if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
|
||||||
QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem);
|
QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem);
|
||||||
if (subRule.hasDrawable() || hasStyleRule(w, PseudoElement_Indicator)) {
|
|
||||||
QStyleOptionViewItem optCopy(*vopt);
|
QStyleOptionViewItem optCopy(*vopt);
|
||||||
|
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);
|
QWindowsStyle::drawControl(ce, &optCopy, p, w);
|
||||||
} else {
|
} else {
|
||||||
QStyleOptionViewItem voptCopy(*vopt);
|
if (hasStyleRule(w, PseudoElement_Indicator)) {
|
||||||
subRule.configurePalette(&voptCopy.palette, QPalette::Text, QPalette::NoRole);
|
subRule.configurePalette(&optCopy.palette, vopt->state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text,
|
||||||
baseStyle()->drawControl(ce, &voptCopy, p, w);
|
vopt->state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base);
|
||||||
|
} else {
|
||||||
|
subRule.configurePalette(&optCopy.palette, QPalette::Text, QPalette::NoRole);
|
||||||
|
}
|
||||||
|
baseStyle()->drawControl(ce, &optCopy, p, w);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user