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

ListView does not remove all delegates, when its model count is reset to 0

    XMLWordPrintable

Details

    • Windows
    • 3818ec46b152dce97ebe88c9b1cecde8573e0a13

    Description

      A ListView is created with a model that is initialized with a number of elements.

      When the model is cleared (i.e. all elements are removed from the model), the ListView.count drops to 0 as expected, but one delegate is still visible in the ListView.

      This seems to happen, when the ListView has also a header item set, only.

       

      Attached, you'll find a sample qml file, which demonstrates the likely bug, and some screenshots. The "Screenshot-zero-elements.jpg" shows that the ListView.count is zero (at the bottom of the window), but there is still a row visible in the ListView.

      A workaround for this issue seems to be to explicitly set currentIndex to -1 as initial value.

      The issue did not appear prior to Qt 5.15.7.

      Attachments

        1. listvieworphanrow.zip
          56 kB
          Christian Poms
        2. Screenshot-all-elements.jpg
          34 kB
          Christian Poms
        3. Screenshot-zero-elements.jpg
          28 kB
          Christian Poms

        Issue Links

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

          Activity

            People

              smd Jan Arve
              vertigo Christian Poms
              Votes:
              7 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes