Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-108191

ListView displaying QAbstractItemModelReplica doesn't display changed data

    XMLWordPrintable

Details

    Description

      Assume we have a QStringListModel called "smodel" with entries

      Row 0: "Track1"

      Row 1: "Track2"

      that is remoted as the source model. There is a QAbstractItemModelReplica acquired from the source model and a ListView that displays the content of this model replica.

      Now we execute the following on the source side:

          smodel->setData(smodel->index(0), "Track1B", Qt::DisplayRole);
          smodel->insertRow(0);
      

      The string change to "Track1B" never populates in the ListView, as all it ever gets is a dataChanged for Row 0.

      When fetchPendingData for Row 0 is called in the replica's onDataChanged(), the new row already has been inserted on the source side, returning an empty string instead of the "Track1B", of course. Row 1 stays without a cache entry.

      The ListView never notices that Row 1 is outdated and displays the old value for that row.

      Is there an oversight from my side on how this should work or is this just an edge case?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bstottle Brett Stottlemyer
            mitja mitja
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes