Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Ad Hoc Charting Help

    QML and Qt Quick
    2
    2
    3766
    Loading More Posts
    • 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.
    • K
      kyleplattner last edited by

      I am trying to chart out some numbers on the fly by creating little rectangles in locations that correspond with a number over a period of time. I am using the Qt.createQMLObject command and it works great except for it kills the object every time it creates a new one. How can I get it to keep making new rectangles without trashing the one before it?

      @property int moveOver: 0
      function chartYield(){

          moveOver = moveOver + 5
      
          Qt.createQmlObject('import Qt 4.7; Rectangle {color: "white"; width: 3; height: 3; x: moveOver; y: yieldIndicator - 50 }',
               dash, "dynamicSnippet1");
      
      }@
      
      1 Reply Last reply Reply Quote 0
      • M
        mbrasser last edited by

        Hi,

        In the above code, it looks like each of the newly created objects might have its x-position bound to the same "global" variable, moveOver. If that is the case, when you increment moveOver all of the items would move to the new position (which might look like the previous items were being deleted). If that is the problem, "assigning the x in Component.onCompleted":http://doc.qt.nokia.com/4.7/qdeclarativejavascript.html#property-assignment-vs-property-binding should fix it.

        Regards,
        Michael

        1 Reply Last reply Reply Quote 0
        • First post
          Last post