diff options
Diffstat (limited to 'src')
3 files changed, 38 insertions, 13 deletions
diff --git a/src/quick/doc/snippets/qml/listview-sections.qml b/src/quick/doc/snippets/qml/listview-sections.qml index 54fc4dd8c8..afbca76ba2 100644 --- a/src/quick/doc/snippets/qml/listview-sections.qml +++ b/src/quick/doc/snippets/qml/listview-sections.qml @@ -23,6 +23,7 @@ ListModel { Component { id: nameDelegate Text { + required property string name text: name; font.pixelSize: 24 anchors.left: parent.left diff --git a/src/quick/doc/snippets/qml/models/views-models-delegates.qml b/src/quick/doc/snippets/qml/models/views-models-delegates.qml index 8a2f0519d6..39b54af3ef 100644 --- a/src/quick/doc/snippets/qml/models/views-models-delegates.qml +++ b/src/quick/doc/snippets/qml/models/views-models-delegates.qml @@ -26,10 +26,19 @@ Rectangle { Component { id: fruitDelegate Row { - id: fruit - Text { text: " Fruit: " + name; color: fruit.ListView.view.fruit_color } - Text { text: " Cost: $" + cost } - Text { text: " Language: " + fruit.ListView.view.model.language } + id: fruit + required property string name + required property real cost + Text { + text: " Fruit: " + fruit.name + color: fruit.ListView.view.fruit_color + } + Text { + text: " Cost: $" + fruit.cost + } + Text { + text: " Language: " + fruit.ListView.view.model.language + } } } diff --git a/src/quick/doc/snippets/qml/repeaters/repeater-grid-index.qml b/src/quick/doc/snippets/qml/repeaters/repeater-grid-index.qml index 945641e37c..29f0f1f558 100644 --- a/src/quick/doc/snippets/qml/repeaters/repeater-grid-index.qml +++ b/src/quick/doc/snippets/qml/repeaters/repeater-grid-index.qml @@ -5,19 +5,34 @@ import QtQuick Rectangle { - width: 400; height: 400; color: "black" + width: 400 + height: 400 + color: "black" Grid { - x: 5; y: 5 - rows: 5; columns: 5; spacing: 10 + x: 5 + y: 5 + rows: 5 + columns: 5 + spacing: 10 - Repeater { model: 24 - Rectangle { width: 70; height: 70 - color: "lightgreen" + Repeater { + model: 24 + Rectangle { + id: delegate - Text { text: index - font.pointSize: 30 - anchors.centerIn: parent } } + required property int index + + width: 70 + height: 70 + color: "lightgreen" + + Text { + text: delegate.index + font.pointSize: 30 + anchors.centerIn: parent + } + } } } } |
