diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-03-12 11:50:13 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-03-13 14:43:11 +0100 |
| commit | ca379b08b2ba634562cbc149d6faddef9f4730bc (patch) | |
| tree | c089ef42ef87598b651b11198e5fc0f7434c3835 /src/quick/doc/snippets/qml/repeaters | |
| parent | 1b72a81ab615e1a6e27063e2cce8baa760784939 (diff) | |
Doc: Modernize some model/view/delegate snippets
Use required properties where possible and unclutter the formatting.
Pick-to: 6.9 6.8
Change-Id: Ib170676892e4eed514fa025d0dc1fd9562ab1a08
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/doc/snippets/qml/repeaters')
| -rw-r--r-- | src/quick/doc/snippets/qml/repeaters/repeater-grid-index.qml | 33 |
1 files changed, 24 insertions, 9 deletions
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 + } + } } } } |
