Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

pi/agent/skills/optional/qml/examples/02-repeater/README.md

Raw
Rendered preview

02: Repeater

Repeater instantiates every delegate as a child of its parent. This example uses a static JavaScript array inside a ColumnLayout.

qml6 repeater.qml

Each array element is available as modelData, and index identifies its position. Layout.fillWidth lets the parent layout assign each row's width.

A plain JavaScript array is not an observable mutable model. Use ListModel or an application model when additions, removals, or role changes must update the view. Use a viewport-based view when all delegates should not exist at once.

# 02: Repeater

`Repeater` instantiates every delegate as a child of its parent.
This example uses a static JavaScript array inside a `ColumnLayout`.

```sh
qml6 repeater.qml
```

Each array element is available as `modelData`, and `index` identifies its position.
`Layout.fillWidth` lets the parent layout assign each row's width.

A plain JavaScript array is not an observable mutable model.
Use `ListModel` or an application model when additions, removals, or role changes must update the view.
Use a viewport-based view when all delegates should not exist at once.