Using a repeater to draw lines from a model?
Unsolved
QML and Qt Quick
-
Hi,
I am working on a plotting library. Right now I need to draw lines for certain events. I have a
QQmlListProperty
which holds the position of the lines on the c++ side. I have a Event.qml object, which is drawing the line (a thin rectangle). I am wondering on what is the best approach to draw the events. I should also mention, that it should be possible to drag the rectangles to new positions and the changes should be written back to the c++ model.Does it make sense to use a repeater? Or should I create the events like this:
function drawEvents() { for(var i=0; i<eventList.length;i++) { var component = Qt.createComponent("Event.qml"); if(component.status == Component.Ready) { var event = component.createObject(root) event.time =eventList[i].time event.name=eventList[i].name event.setX() eventObjects.push(event) } } }