From f4976f86cd265d7505da449dafe15c51e3c8cdc0 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 14 May 2019 10:20:25 +0200 Subject: 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 --- src/widgets/itemviews/qtreeview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3