Access a specific object
Solved
QML and Qt Quick
-
I have created 10 objects in a for loop, and now I want to access for example the third one.
Here's the code used for creating:for (var i = 0; i < 10; i++) { var comp = Qt.createComponent("Rand.qml"); var en = comp.createObject(root, {x: i, y: i*50}); }
Is there a way to access the third one and change its y coordinate (other than manually giving every object an specific id, which would be hard if there were like 100 of them) ?
-
property variant items:[]
items[i] = comp.createObject(root, {x: i, y: i*50});
Now you can access the any objects in items using index.