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. Partial update repeater model QML
Forum Updated to NodeBB v4.3 + New Features

Partial update repeater model QML

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.3k Views 2 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.
  • H Offline
    H Offline
    Hypnostick
    wrote on last edited by p3c0
    #1

    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.

    p3c0P 1 Reply Last reply
    0
    • H Hypnostick

      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.

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by p3c0
      #2

      @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.

      157

      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