aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmltablemodel
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-02-21 17:35:39 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2019-02-22 13:13:28 +0000
commit22435f49499342ff102411c025efb8007dfa62a2 (patch)
tree51bbc0375849451355e8397a77752c95d83349ed /tests/auto/qml/qqmltablemodel
parent2d79c167e0e127e99a4b439dc3c8536770c110a9 (diff)
TableModel.roleDataProvider: replace row, column with index argument
QModelIndex has various advantages over separate int row and column in TableModel API; we intend to expose it via an invokable index() method and via a context property for delegates, and use it in the invokable data() function. So we should be consistent by using it in roleDataProvider too. This way the callback only requires 3 arguments instead of 4, and the first one is potentially extensible, just in case. Change-Id: I7b1bc9ea5adb64941979d83901b3566278357e98 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmltablemodel')
-rw-r--r--tests/auto/qml/qqmltablemodel/data/roleDataProvider.qml4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmltablemodel/data/roleDataProvider.qml b/tests/auto/qml/qqmltablemodel/data/roleDataProvider.qml
index 825a1ad071..2706ea54fd 100644
--- a/tests/auto/qml/qqmltablemodel/data/roleDataProvider.qml
+++ b/tests/auto/qml/qqmltablemodel/data/roleDataProvider.qml
@@ -43,12 +43,12 @@ Item {
[ { name: "Rex" }, { age: 3 } ],
[ { name: "Buster" }, { age: 5 } ]
]
- roleDataProvider: function(row, column, role, cellData) {
+ roleDataProvider: function(index, role, cellData) {
if (role === "display") {
// Age will now be in dog years
if (cellData.hasOwnProperty("age"))
return (cellData.age * 7);
- else if (column === 0)
+ else if (index.column === 0)
return (cellData.name);
}
return cellData;