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

When a proxy model's source model is set after initializiation, QML views show duplicate but undefined items

    XMLWordPrintable

Details

    • Windows

    Description

      That's the issue:

      A Repeater / ListView, that uses a QAbstractProxyModel's derived model, renders twice as many rows as the model's rowCount() indicates. See attached screenshot.

       

       

      The issue happens, when the proxy model's sourceModel is set imperatively after initialization.

      The issue does not happen, when the proxy model's sourceModel property is set declaratively.

       

      QMLTestProxyModel {
          id: qmlTestProxyModel
      
          // Issue does not happen, when sourceModel is set during initialization
          //sourceModel: qmlTestModel
      
          // Issue happens, when sourceModel is set imperatively, after initialization
          Component.onCompleted: {
              qmlTestProxyModel.sourceModel = qmlTestModel
          }
      }
      

       

      Please, see attached example project.

       

       

      Attachments

        1. dupcliate-entries.zip
          3 kB
          Christian Poms
        2. Duplicate-Entries-Screenshot.jpg
          11 kB
          Christian Poms
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            vertigo Christian Poms
            Votes:
            9 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes