summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qtableview.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-04-18 20:46:37 +0200
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-09-17 14:01:28 +0000
commit2b177314139b830ca7e2d5bc414131b0dc9fd5b9 (patch)
treeaeb05bc4b855200456eecb4ca5b42431584dfb53 /src/widgets/itemviews/qtableview.cpp
parent46f1061822fa73cc158b21faf260b20eea16d38b (diff)
QTableView: fix calculating cells to draw
The width of the bitarray which should avoid redraws of already drawn cells is sometimes calculated with other parameters then the actual drawing. This can lead to cells which are not drawn. The reason for the discrepancy is that for the initial calculation the headers viewport width is taken which can be smaller than the real width due to a css border. Since all other QHeaderView operations do not take the border into account the problem arises. This will not fix the visual glitch (the header separators are not painted at the same position as the grid) but will at least draw all needed cells. Task-number: QTBUG-20316 Change-Id: I4a1e35ee3ea51b1b458ad3497aab0a34af680cb8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/itemviews/qtableview.cpp')
-rw-r--r--src/widgets/itemviews/qtableview.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 9725a768de..e7edd08d2a 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -1383,12 +1383,12 @@ void QTableView::paintEvent(QPaintEvent *event)
//firstVisualRow is the visual index of the first visible row. lastVisualRow is the visual index of the last visible Row.
//same goes for ...VisualColumn
int firstVisualRow = qMax(verticalHeader->visualIndexAt(0),0);
- int lastVisualRow = verticalHeader->visualIndexAt(verticalHeader->viewport()->height());
+ int lastVisualRow = verticalHeader->visualIndexAt(verticalHeader->height());
if (lastVisualRow == -1)
lastVisualRow = d->model->rowCount(d->root) - 1;
int firstVisualColumn = horizontalHeader->visualIndexAt(0);
- int lastVisualColumn = horizontalHeader->visualIndexAt(horizontalHeader->viewport()->width());
+ int lastVisualColumn = horizontalHeader->visualIndexAt(horizontalHeader->width());
if (rightToLeft)
qSwap(firstVisualColumn, lastVisualColumn);
if (firstVisualColumn == -1)