From 5c0a9fc532d70ae784cca3e16b5fe59862902815 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 15 Nov 2017 14:55:48 +0100 Subject: QTableView: do not draw grid behind last section QTableView::paintEvent() drawed the grid lines behind the last section when the region to repaint contained rects which were completely behind the last section. This also lead to unnecessary repaints for cells inside rect.top() to rect.bottom() Task-number: QTBUG-60219 Change-Id: I42bb42bea504dfd3c92352ac5c65a43c246a05af Reviewed-by: Richard Moe Gustavsen --- src/widgets/itemviews/qtableview.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 2d5813198c..8ab811e9f7 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1397,6 +1397,9 @@ void QTableView::paintEvent(QPaintEvent *event) } else { dirtyArea.setRight(qMin(dirtyArea.right(), int(x))); } + // dirtyArea may be invalid when the horizontal header is not stretched + if (!dirtyArea.isValid()) + continue; // get the horizontal start and end visual sections int left = horizontalHeader->visualIndexAt(dirtyArea.left()); -- cgit v1.2.3