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 <richard.gustavsen@qt.io>
This commit is contained in:
Christian Ehrlicher 2017-11-15 14:55:48 +01:00
parent f55a40ac03
commit 5c0a9fc532

View File

@ -1397,6 +1397,9 @@ void QTableView::paintEvent(QPaintEvent *event)
} else { } else {
dirtyArea.setRight(qMin(dirtyArea.right(), int(x))); 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 // get the horizontal start and end visual sections
int left = horizontalHeader->visualIndexAt(dirtyArea.left()); int left = horizontalHeader->visualIndexAt(dirtyArea.left());