Reputation: 410
This code:
Repeater {
id: myImageArr
property alias changeSource: imageElement
model: 3
Image {
id: imageElement
}
}
gives me an error:
Invalid alias reference. Unable to find id "imageElement"
Upvotes: 2
Views: 1863
Reputation: 1261
The Image
inside the repeater is dynamically created depending on the model, so you can't refer it directly by id. If your model is a fixed value (3), then you can access the Image
instance by using Repeater.itemAt(index)
function. For example, to create alias to the first Image
created by repeater:
property alias changeSource: myImageArr.itemAt(0)
Upvotes: 2