How to create mupltiple qml components in a loop -


i wish create qml window 100 textedit's example, how create within loop? possible?

a loop imperative code, it's not qml javascript or c++. sure, can (for example embedding qt.createcomponent() call in js loop) in qml, it's better thing think declarative, mean don't 'do' things, 'define' things :

import qtquick 2.0  rectangle {     id: base;     width: 400;     height: 800;      column {         spacing: 5; // simple layout avoid overlapping          repeater {             model: 10; // define number want, can variable             delegate: rectangle {                 width: 200;                 height: 20;                 color: "white";                 border { width: 1; color: "black" }                 radius: 3;                  textinput {                     anchors.fill: parent;                 }             }         }     } } 

this way it's more powerfull , cleaner qml point of view !


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -