I want to instantiate an image in 'sample.qml' multiple times dynamically depending on the count. I am able to create multiple qml instances in run time as below,
Item {
id: container
width: 500; height: 100
z: 100
Component.onCompleted: {
var component = Qt.createComponent("sample.qml");
for (var i=0; i< model.count; i++) {
var object = component.createObject(container);
object.x = (object.width + 250) * i;
}
}
}
Creating is not the issue. But I want to assign x property to a particular instance in run time. How to achieve this and also how to destroy a particular instance. Any suggestions would be really helpful. Thanks.
I'm not able to get a particular instance of the component. Also while using destroy, it is destroying only the last instance created.