Partial update repeater model QML



  • Hi everyone, I'm facing a little issue with QML/C++ project. I'm using a repeater to draw points inside a Rectangle and those points come from a model. Here is my code :

    main.qml

    Rectangle { 
          id: rect
          height:500
          width:500
          Repeater {
              id: pointsRepeater
              model: qListPoints
              Points {
              }
          }
    }
    

    qListPoints come from my C++ where I wrote :
    Q_PROPERTY( QVariant qListPoints READ getListPoints NOTIFY listPointsChanged)

    So basically when I add or update a list point I emit listPointsChanged() and my main.qml redraw new or updated points from the list. My issue is when I add points to my list and I emit listPointsChanged() all points are redrawn, It's like a slow strobe effect. I want only the new point either redraw. Is it possible ?

    Thank you un advance.


  • Moderators

    @Hypnostick listPointsChanged signal will trigger the binding and thus update whole model thus resulting in redraw of all the items. May be you should try with custom C++ models like QAbstractItemModel and then emit dataChanged signal to notify the changes.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.