Skip to content

Commit

Permalink
Don't render PE_PanelItemViewRow under tree decoration if style says no
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Richard Moe Gustavsen <[email protected]>
  • Loading branch information
ec1oud committed May 15, 2019
1 parent 071a0a6 commit f4976f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/widgets/itemviews/qtreeview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f4976f8

Please sign in to comment.