diff options
Diffstat (limited to 'src/quick/doc/snippets/qml/qml-data-models')
4 files changed, 16 insertions, 8 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..eacba90716 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 @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Item { width: 200; height: 250 @@ -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..aa8e5e4833 100644 --- a/src/quick/doc/snippets/qml/qml-data-models/listelements.qml +++ b/src/quick/doc/snippets/qml/qml-data-models/listelements.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [document] -import QtQuick 2.0 +import QtQuick Item { width: 200; height: 250 @@ -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] diff --git a/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview-required.qml b/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview-required.qml index 040b033141..dd7c21b88e 100644 --- a/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview-required.qml +++ b/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview-required.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [document] -import QtQuick 2.0 +import QtQuick Item { width: 200 diff --git a/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview.qml b/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview.qml index 03f3df2304..2942eaf3df 100644 --- a/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview.qml +++ b/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [document] -import QtQuick 2.0 +import QtQuick Item { width: 200; height: 250 |