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

ListView doesn't position at end with dynamic delegates

    XMLWordPrintable

Details

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

    Description

      The ListView in Qt, does not position the view accurately at the bottom when using positionViewAtEnd if the last delegate is significantly larger than others. This is probably caused by the dynamic loading/unloading of components in ListView where the delegate size is not fixed and depends on the content of a chat message.

      Steps to Reproduce:

      1. Populate a ListView using a ListModel and Text where delegates all have the same size, except for the last delegate which is significantly bigger (text wise).
      2. Either scroll or position the ListView at the start to ensure some delegates are unloaded from memory.
      3. Attempt to use positionViewAtEnd to go to the bottom of the ListView.
      4. Observe that the ListView does not scroll to the absolute bottom if the last delegate is significantly larger.

      Expected Result: The ListView should accurately scroll to show the bottom of the list when positionViewAtEnd is called, regardless of the delegate size.

      Actual Result: The ListView incorrectly estimates the size of the dynamically sized delegate and positions the view around the middle of the delegate, failing to reach the bottom. This requires calling positionViewAtEnd twice or employing a delayed timer to correctly position the view at the end.

      Workaround: Currently, can use a timer with a delay is to call positionViewAtEnd twice to correct the view positioning.

      Additional Information:

      • A video demonstrating the issue has been attached.
      • No dynamic modifications (like appending or removing) to the model occur during scroll.
      • The ListView behaviour aligns with the official Qt documentation, indicating dynamic loading/unloading of delegates.

      Attachments:

      • Video demonstrating the incorrect positioning.
      • Sample code snippet that reproduces the issue.

      Please investigate this behaviour as it appears to be a bug with the ListView when handling dynamic delegate sizes.

       

      The same applies when using positionViewAtIndex(list.count - 1, ListView.End)

      Attachments

        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
            asirvys Andrius Sirvys
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes