[SOLVED]access the property of elements of all components created ever in one ducument
-
an important question for me
i have a document and i want create some QML elements in that by this code
@
var component5 = Qt.createComponent("Shape_circle.qml");
if (component5.status == Component.Ready) {
var circle = component5.createObject(adder);
circle.x=mouseX
circle.y=mouseY
component5.destroy();
}
@
that is called using createComponent metod for having same elements in a doc...
now! what i want is that how can i have this elements in a list
for example, i create 10 shapes and i want to change second shape color or size...
or i want to save this shapes size and colors in a file...
can U help me?
thanks -
Hi,
if I understood you correctly, you can store the objects in an array
@
property var arrayOfObjects : []
var circle = component5.createObject(adder);
arrayOfObjects[0] = circle
@ -
OfCourse, if you use as it is. property var arrayOfObjects is meant to be global.
-
Yes. From QML you can use the children property. For eg
@
circle.children[0].color = "red" //just find the exact element
@