Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Range of dataChanged needed
Forum Updated to NodeBB v4.3 + New Features

Range of dataChanged needed

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k 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.
  • A Offline
    A Offline
    albertoMirada
    wrote on last edited by
    #1

    Hello everyone:

    I have a subclass of QAbstractListModel, used from a QML list. This model has, for example, 3 items. It receives an update with 2 new items, and data changes in the other 3 elements. I call beginInsertRows/endInsertRows (because I have 2 new items), but my cuestion is... how should I emit the dataChanged signal? should i include the indexes for new items (from item 0 to item 4 then) or only for old data that really changed (from item 0 to item2)?

    I have the same doubt when items are removed and there are data changes in items that remains.

    thanks in advance and have a good day

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      send the dataChanged signals for the smallest possible scope (not for new items, they are definitly painted new). The dataChange signal is needed by the views to update themselves.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        albertoMirada
        wrote on last edited by
        #3

        Thanks a lot, Gerolf.

        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