path: root/src/widgets
diff options
authorChristian Ehrlicher <>2017-11-15 14:55:48 +0100
committerChristian Ehrlicher <>2017-11-17 20:28:25 +0000
commit5c0a9fc532d70ae784cca3e16b5fe59862902815 (patch)
treeeea775411fb9bcc2128bb9f89104662bf97b7909 /src/widgets
parentf55a40ac039ee1734ddf06c0ddb33cf760b6ebb9 (diff)
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 to rect.bottom() Task-number: QTBUG-60219 Change-Id: I42bb42bea504dfd3c92352ac5c65a43c246a05af Reviewed-by: Richard Moe Gustavsen <>
Diffstat (limited to 'src/widgets')
1 files changed, 3 insertions, 0 deletions
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());