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 <vitaly.fanaskov@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Shawn Rutledge 2019-05-14 10:20:25 +02:00
parent 071a0a6937
commit f4976f86cd

View File

@ -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