I am dynamically creating images in my QML. This is the code I am using:
for (var n = 0; n < 3 * numberOfTiles; n ++) {
var image = imageDefinition.createObject();
image.translationX = getX(n);
image.translationY = getY(n);
image.objectName = ("image"+n)
drawContainer.add(image);
}
Image creating works well, except I don't know how to call those images afterdawrds. I can't set them an ID, and I don't know if setting objectName like that works.
I don't get any errors, and if this work, how can I call "image3" from QML to move it? I don't want to use c++.
Found out a solution on my own. First I add this to have global access
And then I create images in array and copy them over
As it turns out images keeps reference to the image