diff options
| author | Mate Barany <mate.barany@qt.io> | 2025-07-18 15:18:51 +0200 |
|---|---|---|
| committer | Mate Barany <mate.barany@qt.io> | 2025-07-28 13:53:24 +0000 |
| commit | 705c71b5f69a8a2211c94618b3750c8a7733882b (patch) | |
| tree | 3efcffd0085cb580bdd18bac9c22a3576cf0abb9 /src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-complex.qml | |
| parent | 6b58ea261f9031bbb3a849e4bebf5e01d836dfea (diff) | |
Remove support of manipulation of complex rows in QQmlTableModel
TableModel supports complex row structures but only with a limited
functionality. Since the model does not know how a complex row is
structured, it cannot manipulate it. This also means that the copy of
the model data that is stored in rows is not kept in sync with the
source data that was set in QML - the user is supposed to handle
simple data manipulation.
This one functionality was not tested and it seems that the
implementation was changed in the background as setRows is now
called when rows is modified in QML.
A good example is in complex.qml. If we try to extend the
corresponding test case with a setData call it is going to call the
function assigned to setDisplay which calls setRows - something it
was not supposed to do. The checks in setRows do not recognize the
complex row structure and as such the call is not successful.
The checks could be adjusted to work for this specific case, but
the structure could be anything so that solution would not be
generic enough.
Remove the support of manipulation of complex row structures
from QQmlTableModel.
[ChangeLog][Qt labs QML Models] Removed the support of manipulation
of complex row structures from QQmlTableModel.
Task-number: QTBUG-138553
Pick-to: 6.10
Change-Id: I8664ae9ec2e5cd09bc2c88a25f4ac972378e8e94
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-complex.qml')
| -rw-r--r-- | src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-complex.qml | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-complex.qml b/src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-complex.qml deleted file mode 100644 index 70ce56f599..0000000000 --- a/src/qmlmodels/doc/snippets/qml/tablemodel/fruit-example-complex.qml +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -//![file] -import QtQuick -import QtQuick.Window -import Qt.labs.qmlmodels - -Window { - width: 400 - height: 400 - visible: true - - TableView { - anchors.fill: parent - columnSpacing: 1 - rowSpacing: 1 - boundsBehavior: Flickable.StopAtBounds - - model: TableModel { - TableModelColumn { - display: function(modelIndex) { return rows[modelIndex.row][0].checked } - setDisplay: function(modelIndex, cellData) { rows[modelIndex.row][0].checked = cellData } - } - TableModelColumn { - display: function(modelIndex) { return rows[modelIndex.row][1].amount } - setDisplay: function(modelIndex, cellData) { rows[modelIndex.row][1].amount = cellData } - } - TableModelColumn { - display: function(modelIndex) { return rows[modelIndex.row][2].fruitType } - setDisplay: function(modelIndex, cellData) { rows[modelIndex.row][2].fruitType = cellData } - } - TableModelColumn { - display: function(modelIndex) { return rows[modelIndex.row][3].fruitName } - setDisplay: function(modelIndex, cellData) { rows[modelIndex.row][3].fruitName = cellData } - } - TableModelColumn { - display: function(modelIndex) { return rows[modelIndex.row][4].fruitPrice } - setDisplay: function(modelIndex, cellData) { rows[modelIndex.row][4].fruitPrice = cellData } - } - - // Each row is one type of fruit that can be ordered -//![rows] - rows: [ - [ - // Each object (line) is one cell/column. - { checked: false, checkable: true }, - { amount: 1 }, - { fruitType: "Apple" }, - { fruitName: "Granny Smith" }, - { fruitPrice: 1.50 } - ], - [ - { checked: true, checkable: true }, - { amount: 4 }, - { fruitType: "Orange" }, - { fruitName: "Navel" }, - { fruitPrice: 2.50 } - ], - [ - { checked: false, checkable: false }, - { amount: 1 }, - { fruitType: "Banana" }, - { fruitName: "Cavendish" }, - { fruitPrice: 3.50 } - ] - ] -//![rows] - } -//![delegate] - delegate: TextInput { - text: model.display - padding: 12 - selectByMouse: true - - onAccepted: model.display = text - - Rectangle { - anchors.fill: parent - color: "#efefef" - z: -1 - } - } -//![delegate] - } -} -//![file] |
