aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2023-01-20 10:49:31 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2023-02-13 16:40:30 +0100
commitaea8c9e0934b7250b73d7c055f907abab7c8e868 (patch)
tree3d4206f249f5aaf377e42910373d4f14089d4e8f /tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
parentc0918d63065662d3e42049892c565a9a4c2007f5 (diff)
TableView: deprecate modelIndex(row, column) in favor of index(row, column)
Deprecate modelIndex(row, column) in favor of a new function index(row, column), starting from Qt 6.4.3. This has the advantage that we can print out a deprecation warning when modelIndex() is is used at run-time from QML. This will inform the developer early on that he should avoid using modelIndex(row, column), since the argument order differs between different versions of Qt. Relying on compile time deprecation macros alone will not work, since the API break is in a private class and only used publicly from QML (except for our own internal auto tests). Since the equivalent function in QAIM is also called index(row, column), this will additionally make the naming more consistent with the model classes. [ChangeLog][Quick][TableView] modelIndex(row, column) has been deprecated in favor of index(row, column). Task-number: QTBUG-109542 Pick-to: 6.5 6.4 Change-Id: Iec8f5f8fa2a0ca714153128717b546bbd62c7e2c 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.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
index ecea4adfd5..7287e3ba89 100644
--- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
+++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
@@ -5358,7 +5358,7 @@ void tst_QQuickTableView::disablePointerNavigation()
// Enable navigation, and try again
tableView->setPointerNavigationEnabled(true);
QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, pos);
- QCOMPARE(selectionModel.currentIndex(), tableView->modelIndex(0, 0));
+ QCOMPARE(selectionModel.currentIndex(), tableView->index(0, 0));
QVERIFY(item0_0->property("current").toBool());
QCOMPARE(tableView->currentColumn(), cell0_0.x());
QCOMPARE(tableView->currentRow(), cell0_0.y());
@@ -7075,7 +7075,7 @@ void tst_QQuickTableView::editWarning_noEditDelegate()
WAIT_UNTIL_POLISHED;
QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*cannot edit: no TableView.editDelegate set!"));
- tableView->edit(tableView->modelIndex(1, 1));
+ tableView->edit(tableView->index(1, 1));
}
void tst_QQuickTableView::editWarning_invalidIndex()
@@ -7090,7 +7090,7 @@ void tst_QQuickTableView::editWarning_invalidIndex()
WAIT_UNTIL_POLISHED;
QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*cannot edit: index is not valid!"));
- tableView->edit(tableView->modelIndex(-1, -1));
+ tableView->edit(tableView->index(-1, -1));
}
void tst_QQuickTableView::editWarning_nonEditableModelItem()
@@ -7108,7 +7108,7 @@ void tst_QQuickTableView::editWarning_nonEditableModelItem()
WAIT_UNTIL_POLISHED;
QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*cannot edit:.*flags.*Qt::ItemIsEditable"));
- tableView->edit(tableView->modelIndex(1, 1));
+ tableView->edit(tableView->index(1, 1));
}
void tst_QQuickTableView::attachedPropertiesOnEditDelegate()
@@ -7214,7 +7214,7 @@ void tst_QQuickTableView::requiredPropertiesOnEditDelegate()
const QPoint cell(1, 1);
const QModelIndex index1 = tableView->modelIndex(cell);
- const QModelIndex index2 = tableView->modelIndex(2, 2);
+ const QModelIndex index2 = tableView->index(2, 2);
tableView->edit(index1);