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

ListView never pools first item

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.0
    • None
    • Windows

    Description

      If you create a simple list view with reuseItems enabled the ListView will never fire ListView.onRemove, ListView.onPooled or ListView.onReused for the first item in the list. This would be ok on it's own however ListView.itemAtIndex(0) will return null as if the item has been pooled.

      The below gif shows a simple list view and a button that will print the item at index zero. When the first item is in view pressing the button correctly prints the item. However when scrolled out you should see that none of the pooling signals are emitted for the first item however the button then returns null.

       
      This can make correctly updating properties on a delegate tricky.
       
      See the attached Main.qml file for the code shown in the above gif.

      Attachments

        1. image-2023-07-16-10-05-20-150.png
          image-2023-07-16-10-05-20-150.png
          469 kB
        2. Main.qml
          1 kB
        3. stack-trace.png
          stack-trace.png
          230 kB
        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
            haiku Ollie Dawes
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes