I have a QML application with several Rectangle Elements put within a Column Element.
Is there any way i can Iterate through these Column using some index .. so that i can change property of a particular rectangle within the the Column .
I have a QML application with several Rectangle Elements put within a Column Element.
Is there any way i can Iterate through these Column using some index .. so that i can change property of a particular rectangle within the the Column .
up on this post because i'm interested.
Iterating over (and if is possible, delete) dynamically created elements (with createObject) in QML column.
Would not be sufficient just to create objects inside JavaScript, like mentioned in Qt docs, store them, for example in an array, and than call destroy() method on the objects, that are no longer needed ? To be precise objects' parent should be the column element, which would placed them inside of it...
My schedule makes my cry
My works makes my laugh
My life makes... oh...no....
I've tried with an array but for some reason is not useful for my purpose. But i've found a solution that works fine form me.
Every time that a new object is created with createObject i do this:
var obj = [].createobject();
obj.variousData=someVariusDataPassed;
obj.objectName: "dynObject_"+identificator
and from c++ now is simple find and use the created object via his objectName.
The identificator is a number passed from c++ when it call the function containing the previous code.
Yes, you can iterate children, for example:
Qt Code:
for (var i = 0; i < column.children.length; ++i) column.children[i].width = column.width;To copy to clipboard, switch view to plain text mode
J-P Nurmi
Bookmarks