[SOLVED] Iteration of QML elements
How can I iterate a part of qml code with a help of js or c++ maybe.
That,s what I want to do -
/->code to iterate/
onEntered:parent.border.color = "#ffffff"
onExited:parent.border.color = "#000000"
if(parent.opacity == 1)parent.opacity = 0.5
else parent.opacity = 1
/<-code to iterate/
I thought about creating objects from .qml file in a cycle in js but in this case I can,t use LibJs object because of variables in js will be redifined each time I call LibJs.updateDeckMemResults(i). Google didn
t help, but may be I didnt asked right question...
task_struct last edited by
If I understand you right, you want to create 10 Rectangles. You could use "Repeater":http://doc.qt.nokia.com/4.7-snapshot/qml-repeater.html and it`s property index
You basically want to dynamically generate 10 instances of a Component (the Rectangle).
You should split it out into a separate .qml file (eg, MyRect.qml), and then you can use Qt.createComponent() and Qt.createObject() to construct instances dynamically.
Alternatively, you could use a Repeater or something (http://doc.qt.nokia.com/5.0-snapshot/qml-qtquick2-repeater.html).
Thank you very much - this is perfect solution in my case.