diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2023-01-25 12:47:23 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2023-02-13 16:40:37 +0100 |
commit | 3773ad8534d58db21fd9309724130c527ae5c8b8 (patch) | |
tree | b9f2e332f45959b0afcd95fe0f22dccce6fb0f29 /tests/auto/quick/qquicktableview/tst_qquicktableview.cpp | |
parent | 3343c57b02b952b429167f7c353e7288d6c0d5e7 (diff) |
TableView: deprecate positionViewAtCell(column, row) in favor of positionViewAtIndex(modelIndex)
After deprecating modelIndex(column, row) in favor
of index(row, column), we should now do the same to
positionViewAtCell(column, row), to be consistent.
This function will therefore deprecate
positionViewAtCell(column, row) and instead offer
a new function positionViewAtIndex(modelIndex).
[ChangeLog][Quick][TableView] positionViewAtCell(column, row)
has been deprecated in favor of positionViewAtIndex(modelIndex).
Task-number: QTBUG-109542
Pick-to: 6.5
Change-Id: Id47f990a6148acdb7c1185c7f654d6f2b261b2ad
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicktableview/tst_qquicktableview.cpp')
-rw-r--r-- | tests/auto/quick/qquicktableview/tst_qquicktableview.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp index 034acb4dc7..dc8b480cc3 100644 --- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp +++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp @@ -3770,14 +3770,15 @@ void tst_QQuickTableView::positionViewAtCellWithAnimation() QPoint cell(tableView->rightColumn(), tableView->bottomRow()); const QRectF cellGeometry = tableViewPrivate->loadedTableItem(cell)->geometry(); - const int modelIndex = tableViewPrivate->modelIndexAtCell(cell); + const int serializedIndex = tableViewPrivate->modelIndexAtCell(cell); + const QModelIndex index = tableView->index(cell.y(), cell.x()); - QVERIFY(tableViewPrivate->loadedItems.contains(modelIndex)); + QVERIFY(tableViewPrivate->loadedItems.contains(serializedIndex)); QVERIFY(!tableViewPrivate->positionXAnimation.isRunning()); QVERIFY(!tableViewPrivate->positionYAnimation.isRunning()); // Animate the cell to the top left location in the view - tableView->positionViewAtCell(cell, QQuickTableView::AlignTop | QQuickTableView::AlignLeft); + tableView->positionViewAtIndex(index, QQuickTableView::AlignTop | QQuickTableView::AlignLeft); // Wait for animation to finish QVERIFY(tableViewPrivate->positionXAnimation.isRunning()); @@ -3786,13 +3787,13 @@ void tst_QQuickTableView::positionViewAtCellWithAnimation() QTRY_COMPARE(tableViewPrivate->positionYAnimation.isRunning(), false); // Check that the cell is now placed in the top left corner - QVERIFY(tableViewPrivate->loadedItems.contains(modelIndex)); + QVERIFY(tableViewPrivate->loadedItems.contains(serializedIndex)); QPointF expectedPos = tableView->mapToItem(tableView->contentItem(), QPointF(0, 0)); QCOMPARE(cellGeometry.x(), expectedPos.x()); QCOMPARE(cellGeometry.y(), expectedPos.y()); // Animate the cell to the top right location in the view - tableView->positionViewAtCell(cell, QQuickTableView::AlignTop | QQuickTableView::AlignRight); + tableView->positionViewAtIndex(index, QQuickTableView::AlignTop | QQuickTableView::AlignRight); // Wait for animation to finish QVERIFY(tableViewPrivate->positionXAnimation.isRunning()); @@ -3800,13 +3801,13 @@ void tst_QQuickTableView::positionViewAtCellWithAnimation() QTRY_COMPARE(tableViewPrivate->positionXAnimation.isRunning(), false); // Check that the cell is now placed in the top right corner - QVERIFY(tableViewPrivate->loadedItems.contains(modelIndex)); + QVERIFY(tableViewPrivate->loadedItems.contains(serializedIndex)); expectedPos = tableView->mapToItem(tableView->contentItem(), QPointF(tableView->width(), 0)); QCOMPARE(cellGeometry.right(), expectedPos.x()); QCOMPARE(cellGeometry.y(), expectedPos.y()); // Animate the cell to the bottom left location in the view - tableView->positionViewAtCell(cell, QQuickTableView::AlignBottom | QQuickTableView::AlignLeft); + tableView->positionViewAtIndex(index, QQuickTableView::AlignBottom | QQuickTableView::AlignLeft); // Wait for animation to finish QVERIFY(tableViewPrivate->positionXAnimation.isRunning()); @@ -3815,7 +3816,7 @@ void tst_QQuickTableView::positionViewAtCellWithAnimation() QTRY_COMPARE(tableViewPrivate->positionYAnimation.isRunning(), false); // Check that the cell is now placed in the bottom left corner - QVERIFY(tableViewPrivate->loadedItems.contains(modelIndex)); + QVERIFY(tableViewPrivate->loadedItems.contains(serializedIndex)); expectedPos = tableView->mapToItem(tableView->contentItem(), QPointF(0, tableView->height())); QCOMPARE(cellGeometry.x(), expectedPos.x()); QCOMPARE(cellGeometry.bottom(), expectedPos.y()); @@ -3829,7 +3830,7 @@ void tst_QQuickTableView::positionViewAtCellWithAnimation() QTRY_COMPARE(tableViewPrivate->positionXAnimation.isRunning(), false); // Check that the cell is now placed in the bottom right corner - QVERIFY(tableViewPrivate->loadedItems.contains(modelIndex)); + QVERIFY(tableViewPrivate->loadedItems.contains(serializedIndex)); expectedPos = tableView->mapToItem(tableView->contentItem(), QPointF(tableView->width(), tableView->height())); QCOMPARE(cellGeometry.right(), expectedPos.x()); QCOMPARE(cellGeometry.bottom(), expectedPos.y()); |