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. QAbstractItemView::dataChanged problem with ranges
Forum Updated to NodeBB v4.3 + New Features

QAbstractItemView::dataChanged problem with ranges

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.6k 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.
  • B Offline
    B Offline
    bmatos
    wrote on last edited by
    #1

    Hi,

    When I emit a dataChanged with a topLeft index different from the bottomRight index, the view updates all cells.
    Is there a reason for this?

    Thank you,
    Bruno

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Different views use different rendering strategies, AFAIK. Views can use the information about the range to limit their rendering, but they are under no obligation to do so. What view are you using?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bmatos
        wrote on last edited by
        #3

        I'm using TableView. I have a lot of data updates, so I'm buffering the updates and, with a given interval, I emit the dataChanged for the topLeft until the bottomRight indexes of buffered data, but the model's data method is called for every cell. Emit a signal for every updated cell will have a performance penalty too. A range update would be the best choice, I think.

        Thank you,
        Bruno

        1 Reply Last reply
        0
        • JeroentjehomeJ Offline
          JeroentjehomeJ Offline
          Jeroentjehome
          wrote on last edited by
          #4

          Got myself the same problem. I update a QString list and want that QString list in a tableView (1 QString list per row), but how do I just update 1 row?
          Greetz

          Greetz, Jeroen

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bmatos
            wrote on last edited by
            #5

            I found some tickets in QT's JIRA, one of them: QTBUG-13668. It seems this is the expected behavior, although I have some questions about it. I sow the source code of QAbstractItemView::dataChanged and there is a big difference handling topLeft == bottomRight and topLeft != bottomRight. In the first case only the cell with the given index is updated, in the second case, it passes the update responsibility to the viewport. For me this is a strange behavior, I would expect that the update was always handle by the viewport or always handled by QAbstractItemView and not distinguished if is only a cell or more.

            I can see 2 solutions:

            • Re-implement dataChanged method;
            • Emit one signal for each cell.

            Any other suggestion would be appreciated.

            Tia,
            Bruno

            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