diff options
authorShawn Rutledge <>2019-05-14 10:20:25 +0200
committerShawn Rutledge <>2019-05-15 18:07:13 +0000
commitf4976f86cd265d7505da449dafe15c51e3c8cdc0 (patch)
parent071a0a6937432ad60c1b261af9f5b48861fbb70c (diff)
Don't render PE_PanelItemViewRow under tree decoration if style says no
Fusion style's SH_ItemView_ShowDecorationSelected hint is hard-coded to 1, but in QCommonStyle::drawPrimitive (which QFusionStyle inherits) it only asked its own QFusionStyle::styleHint() before drawing the background that happens to be under the tree row decoration (arrow thingy or +/- symbol). And the style doing the rendering does not know about QStyleSheetStyle so by the time we get to QCommonStyle::drawPrimitive() it's too late to check. Therefore QTreeView needs to avoid calling it in this case. Fixes: QTBUG-73251 Change-Id: I2d0ed4d3b2ee805a5602122273387982caa564f8 Reviewed-by: Vitaly Fanaskov <> Reviewed-by: Richard Moe Gustavsen <>
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index f3647f656a..5a7615b388 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1741,7 +1741,8 @@ void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option,
// draw background for the branch (selection + alternate row)
opt.rect = branches;
- style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, this);
+ if (style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, &opt, this))
+ style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, this);
// draw background of the item (only alternate row). rest of the background
// is provided by the delegate