diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-03-17 13:53:51 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-03-21 11:27:17 +0100 |
commit | d32f8bfa1a807acb2967bbecaa661f0587890ae1 (patch) | |
tree | 4d855c407272aca7dad4cf3ff78c6451823a5fd9 /src/quick/doc/snippets/qml/qml-data-models | |
parent | 6b0744066b55cb4e4666ff0114252a6dd6be6e47 (diff) | |
download | qtdeclarative-d32f8bfa1a807acb2967bbecaa661f0587890ae1.tar.gz |
Doc: Update documentation on model/view/delegates
You should generally use required properties for all of this.
Furthermore, correct some grammar problems, and synchronize the
documentation to the examples it references. Remove the non-working
ListElement in a C++-defined model.
Pick-to: 6.5
Change-Id: I1be9b9997a86dc1028a71bdd5a94d6919c0f8a81
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/doc/snippets/qml/qml-data-models')
-rw-r--r-- | src/quick/doc/snippets/qml/qml-data-models/dynamic-listmodel.qml | 8 | ||||
-rw-r--r-- | src/quick/doc/snippets/qml/qml-data-models/listelements.qml | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/quick/doc/snippets/qml/qml-data-models/dynamic-listmodel.qml b/src/quick/doc/snippets/qml/qml-data-models/dynamic-listmodel.qml index 4bf9fccb93..3c69012f67 100644 --- a/src/quick/doc/snippets/qml/qml-data-models/dynamic-listmodel.qml +++ b/src/quick/doc/snippets/qml/qml-data-models/dynamic-listmodel.qml @@ -15,8 +15,12 @@ Item { anchors.fill: parent model: fruitModel delegate: Row { - Text { text: "Fruit: " + name } - Text { text: "Cost: $" + cost } + id: delegate + required property string name + required property real cost + + Text { text: "Fruit: " + delegate.name } + Text { text: "Cost: $" + delegate.cost } } } //! [view] diff --git a/src/quick/doc/snippets/qml/qml-data-models/listelements.qml b/src/quick/doc/snippets/qml/qml-data-models/listelements.qml index bab4aec6a2..eecde1af0b 100644 --- a/src/quick/doc/snippets/qml/qml-data-models/listelements.qml +++ b/src/quick/doc/snippets/qml/qml-data-models/listelements.qml @@ -31,8 +31,12 @@ Item { anchors.fill: parent model: fruitModel delegate: Row { - Text { text: "Fruit: " + name } - Text { text: "Cost: $" + cost } + id: delegate + required property string name + required property real cost + + Text { text: "Fruit: " + delegate.name } + Text { text: "Cost: $" + delegate.cost } } } //! [view] |