diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-05-23 14:52:29 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-05-27 15:43:50 +0200 |
commit | 8ef0407ddd4c8b7f3e685d8a5316dbcb323badd2 (patch) | |
tree | f309c8377088505ba400a5b61450d730facce51a /tests | |
parent | 2a58e518113f5c3b05449d478f203925d4755f52 (diff) |
QQuickTableView: add a new 'alternatingRows' property
Add a new property 'alternatingRows' that informs the
delegate that it should alternate between rows.
This is merely a hint, the delegate is free
to ignore it. But our own internal delegates, like
TreeViewDelegate, should not.
[ChangeLog][Quick][TableView] Added a new property
'alternatingRows', which is a hint to the delegate
to alternate between rows.
Change-Id: I3f10e7280332b652d393348ff0d71cd73ce6fa4d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicktableview/tst_qquicktableview.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp index 2e02e5873d..59a257a7f5 100644 --- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp +++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp @@ -230,6 +230,7 @@ private slots: void selectUsingHomeAndEndKeys(); void selectUsingPageUpDownKeys(); void testDeprecatedApi(); + void alternatingRows(); }; tst_QQuickTableView::tst_QQuickTableView() @@ -4948,6 +4949,18 @@ void tst_QQuickTableView::testDeprecatedApi() QCOMPARE(tableView->bottomRow(), model.rowCount() - 1); } +void tst_QQuickTableView::alternatingRows() +{ + // Check that you can set 'alternate' + LOAD_TABLEVIEW("plaintableview.qml"); + + QVERIFY(tableView->alternatingRows()); + tableView->setAlternatingRows(false); + QVERIFY(!tableView->alternatingRows()); + tableView->setAlternatingRows(true); + QVERIFY(tableView->alternatingRows()); +} + QTEST_MAIN(tst_QQuickTableView) #include "tst_qquicktableview.moc" |