If wrote the following code:
Repeater { model: 10;
delegate: Rectangle { width: 200; height:
20; color: "white";}}
How can I give all the 10 rectangles a different id?
You can not assign a different id, also the id has a scope whose limit is the delegate, if you want to access an item you must use the itemAt()
method passing the index:
Repeater {
id: repeater
model: 10;
delegate: Rectangle {
width: 200;
height: 20;
color: "white";
}
}
// ...
var item = repeater.itemAt(2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With