Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Using a repeater to draw lines from a model?

Using a repeater to draw lines from a model?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 253 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maxwell31
    wrote on last edited by
    #1

    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)
            }
            }
        }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved