summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtableview
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-03-04 16:00:46 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-03-05 08:58:49 (GMT)
commit0f89d7ef7b5e961cfc6ee7960ad6bf07eff71691 (patch)
tree0b1c69cbac099845ad7a01101212b3a1381edde9 /tests/auto/qtableview
parent46d5f85a03bd87708152baba2674f2e5f36afe22 (diff)
downloadQt-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 'tests/auto/qtableview')
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index a5cbbd4..35fba52 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -200,6 +200,7 @@ private slots:
void taskQTBUG_4516_clickOnRichTextLabel();
void taskQTBUG_5237_wheelEventOnHeader();
void taskQTBUG_8585_crashForNoGoodReason();
+ void taskQTBUG_7774_RtoLVisualRegionForSelection();
void mouseWheel_data();
void mouseWheel();
@@ -3994,5 +3995,30 @@ void tst_QTableView::taskQTBUG_8585_crashForNoGoodReason()
}
+class TableView7774 : public QTableView
+{
+public:
+ QRegion visualRegionForSelection(const QItemSelection &selection) const
+ {
+ return QTableView::visualRegionForSelection(selection);
+ }
+};
+
+void tst_QTableView::taskQTBUG_7774_RtoLVisualRegionForSelection()
+{
+ TableView7774 view;
+ QStandardItemModel model(5,5);
+ view.setModel(&model);
+ view.setLayoutDirection(Qt::RightToLeft);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ QItemSelectionRange range(model.index(2, 0), model.index(2, model.columnCount() - 1));
+ QItemSelection selection;
+ selection << range;
+ QRegion region = view.visualRegionForSelection(selection);
+ QCOMPARE(region.rects().at(0), view.visualRect(range.topLeft()) | view.visualRect(range.bottomRight()));
+}
+
QTEST_MAIN(tst_QTableView)
#include "tst_qtableview.moc"