Dynamically build qml with javascript
-
Hey folks,
is there a way to build qml UIs dynamically using javascript.
In my case, I have a QList of objects in C++ which I wanna convert into qml elements.
I would iterate through the objects of the QList and build for example qml Rectangles for each object.How could I implement something like this.
Thanks for help
-
Hi,
I'm not sure if it will help in this case, but if you haven't read it already I would suggest looking at http://doc.qt.nokia.com/4.7-snapshot/qdeclarativedynamicobjects.html as a first step, as it goes over the various ways to work with dynamic objects in QML.
Regards,
Michael -
-
[quote author="Schneidi" date="1302112337"]Hey Michael,
maybe the examples in your link could be helpful. Thanks so far.
Hi Andre, afaik delegates are representations of list entries.
What I wanna do is to implement the QList entries from C++ as different elements
like screens or buttons etc. [/quote]Ok, it is just that at first, you were talking about rectangles. You are right, delegates are used to display items from a model, but based on your first description, that was basically all you needed :-)