diff options
| author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-04-07 15:03:19 +0200 |
|---|---|---|
| committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-04-11 19:37:20 +0200 |
| commit | b9dcf12a463026d09b6bfa4ed213f62a480fb5f2 (patch) | |
| tree | b6fe14143b2ff460d93a9c3c63619acd4821e3f4 /src/quick/doc/snippets/qml/tableview | |
| parent | 19d19864166e03405cb145de8141f905d0a6d4fd (diff) | |
QQuickTableView: keep selection model and tableview model in sync
The source model in the selection model will always need to be
the same as the source model in TableView. So TableView
might as well forward its own model to the selection model, so
that the user don't need to worry about setting the model
explicitly. The same is also done in QTableView.
Still, it's always possible to force (perhaps by accident?) the
two models to be different. To avoid confusion, we choose to
print a warning if that happens.
Change-Id: I9fec1d3de4cfe83cf28950ebdedd38a010df16a3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/doc/snippets/qml/tableview')
| -rw-r--r-- | src/quick/doc/snippets/qml/tableview/selectionmodel.qml | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/quick/doc/snippets/qml/tableview/selectionmodel.qml b/src/quick/doc/snippets/qml/tableview/selectionmodel.qml index 8d7cb05f1c..6b63383a16 100644 --- a/src/quick/doc/snippets/qml/tableview/selectionmodel.qml +++ b/src/quick/doc/snippets/qml/tableview/selectionmodel.qml @@ -73,9 +73,7 @@ Window { rows: [ { "name": "Harry" }, { "name": "Hedwig" } ] } - selectionModel: ItemSelectionModel { - model: tableView.model - } + selectionModel: ItemSelectionModel {} delegate: Rectangle { implicitWidth: 100 |
