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

Qml TableView scrolling is off by small amount if the TableView is shown second time after being scrolled

    XMLWordPrintable

Details

    Description

      When opening a TableView (by modifying visible flag) that contains enough items to have scrolling enabled, scrolling the list down and up breaks the view when TableView is shown next time. After opening the TableView second time (with visible flag and repopulating the view), the view part ends up being scrolled by 1-2 items down, whereas the scrollbar is correctly scrolled to position 0. User has to scroll the scrollbar down by at least one pixel (or click) for the view to adjust the scrolling position correctly again.

      Calling tableView.positionViewAtRow(0, ListView.Beginning); after repopulating the list fixes the view scrolling problem, but as a tradeof it (naturally) breaks the previous remembered scroll position.

      One thing to note is that the model is repopulated each time the TableView is shown.

      Steps to reproduce:

      • Run attached sample
      • Press "Show dialog" button
      • Scroll list down and up, so that it ends up at scroll position 0
      • Press "Ok"
      • Press "Show dialog" button again
      • EXPECTED: Scroll position is remembered for both view and scrollbar
      • ACTUAL: Scrollbar is properly at position 0, but the scroll view shows half of the second item, and so is scrolled down 1-2 items

       

      EDIT (2017/6/27): The scrollbar's behavior can be reproduced even without repopulating the model. See 'qtbug54122_sample2'.

      How to observe:

      • run sample2 attached
      • move the scroll bar
      • set the scroll bar position either to the very top or to the very bottom
      • press 'Change Visibility' button (alternate between hide and show)
      • observe the console.log output and notice how the scroll bar position changes. At the top position this causes the scroll bar to move as pointed out in the original sample.

      Attachments

        1. qtbug54122_broken.png
          13 kB
          Jussi Witick
        2. qtbug54122_proper.png
          16 kB
          Jussi Witick
        3. qtbug54122_sample2.zip
          2 kB
          Risto Sipola
        4. qtbug54122.zip
          2 kB
          Jussi Witick
        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
            jussi_witick Jussi Witick
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes