diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-03-04 16:00:46 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-03-05 08:58:49 (GMT) |
commit | 0f89d7ef7b5e961cfc6ee7960ad6bf07eff71691 (patch) | |
tree | 0b1c69cbac099845ad7a01101212b3a1381edde9 /src/gui/itemviews | |
parent | 46d5f85a03bd87708152baba2674f2e5f36afe22 (diff) | |
download | Qt-0f89d7ef7b5e961cfc6ee7960ad6bf07eff71691.zip Qt-0f89d7ef7b5e961cfc6ee7960ad6bf07eff71691.tar.gz Qt-0f89d7ef7b5e961cfc6ee7960ad6bf07eff71691.tar.bz2 |
Wrong dirty region after row selection in right-to-left mode in QTableView
When computing the region from the selection range, we didn't take
care of the actual position of the cells, which is reverted when in
RtoL mode. Also gets fixed a 2-pixel error introduced in commit
718905c097a7f3bbf9805a2561cd855a0b2d8f59, and that was responsible for
(potentialy) painting more cells than needed.
Auto-test included.
Reviewed-by: Olivier
Task-number: QTBUG-7774
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qtableview.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 3111896..cf1b542 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1908,6 +1908,7 @@ QRegion QTableView::visualRegionForSelection(const QItemSelection &selection) co width, rowHeight(r))); } } else { // nothing moved + const int gridAdjust = showGrid() ? 1 : 0; for (int i = 0; i < selection.count(); ++i) { QItemSelectionRange range = selection.at(i); if (range.parent() != d->root || !range.isValid()) @@ -1916,9 +1917,16 @@ QRegion QTableView::visualRegionForSelection(const QItemSelection &selection) co const int rtop = rowViewportPosition(range.top()); const int rbottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom()); - const int rleft = columnViewportPosition(range.left()); - const int rright = columnViewportPosition(range.right()) + columnWidth(range.right()); - selectionRegion += QRect(QPoint(rleft, rtop), QPoint(rright, rbottom)); + int rleft; + int rright; + if (isLeftToRight()) { + rleft = columnViewportPosition(range.left()); + rright = columnViewportPosition(range.right()) + columnWidth(range.right()); + } else { + rleft = columnViewportPosition(range.right()); + rright = columnViewportPosition(range.left()) + columnWidth(range.left()); + } + selectionRegion += QRect(QPoint(rleft, rtop), QPoint(rright - 1 - gridAdjust, rbottom - 1 - gridAdjust)); if (d->hasSpans()) { foreach (QSpanCollection::Span *s, d->spans.spansInRect(range.left(), range.top(), range.width(), range.height())) { |