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. QObjectList as model is not updated by Repeater when changing data of model!

QObjectList as model is not updated by Repeater when changing data of model!

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 778 Views
  • 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.
  • J Offline
    J Offline
    jackmack
    wrote on last edited by
    #1

    Hi all,

    I try to use a QObjectList in C++ as model for a QML Repeater instance.
    If I add a new object to QObjectList in C++, the Repeater destroys all prior created items and creates new items.

    I think this is ugly because if the list has many objects and I add only one new object then all QML items instantiated by Repeater's delegate are destroyed and the created once again.

    But the main issue is that if I change only the content/data of a single object of QObjectList the Repeater does nothing - either destroy of all old elements nor update the single object.

    Currently I solved it by remove the last object, emit the listChanged() signal (then the Repeater is updated), append the last one again, emits listChanged() once again. That's double ugly!!

    Can I solve this by implementing my own model inherited from QAbstractListModel?

    Are there any other elements to visualize a model than Repeater? The background is that I load several visual informations (x, y, size) from a file and want to place it to e.g. a Rectangle.

    Thanks a lot for answers... I use Quick 1.1 with Qt 4.8.5.

    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