diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-07-14 09:33:02 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-14 14:17:46 +0000 |
commit | cf52d725156811754cd4e094b0984864795d1d58 (patch) | |
tree | 38b9a24a1d619013a15d8374fcd8385b20ec37d3 /src | |
parent | 2b699ff4ef11fde343d8d48c0426369b394828cb (diff) |
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
Change-Id: I1cd8c4fce48cb5543337415918fc99ffb5e19e00
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 1d48572b4ea765cb8d81bf227eabaf907a91e7de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index fab5b891b4..51482d50f3 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4270,15 +4270,19 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q case CE_ItemViewItem: if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { 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, vopt->state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base); QWindowsStyle::drawControl(ce, &optCopy, p, w); } else { - QStyleOptionViewItem voptCopy(*vopt); - subRule.configurePalette(&voptCopy.palette, QPalette::Text, QPalette::NoRole); - baseStyle()->drawControl(ce, &voptCopy, p, w); + if (hasStyleRule(w, PseudoElement_Indicator)) { + subRule.configurePalette(&optCopy.palette, vopt->state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text, + 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; } |