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

macOS: QtQuick ItemView sometimes stuck at currentItem whilst scrolling

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.11.2
    • 5.11
    • None
    • macOS (seems to be a Mac-only problem)
    • macOS
    • d868bb4f3e4b0424fd4a2989ff1c82692b0f014c b0c79a8bf41d3ae79c23e53afdcdba92ec0ec0b5

    Description

      If a currentItem/currentIndex exists the ItemViews (noticed with ListView) can sometimes get stuck to the current item whilst scrolling after a currentIndex is set.

      This happens when you:

      • click some item in the example (to set currentIndex and moveReason to SetIndex)
      • scroll down really slowy (I'm using a Mac with an Apple Magic Mouse)

      QQuickListView::viewportMoved uses vData.flicking und vData.moving (and hData counterparts) to detect mouse interaction. When scrolling slowly those properties are all "false" so moveReason is kept at SetIndex.

      In this situation QQuickItemView::refill -> visibleItemsChanged -> updateHighlight -> updateTrackedItem -> trackedPositionChanged sometimes calls QQuickItem::setPosition with the currentItem's position which clashes with the scroll positioning.

      The two changes for -----QTBUG-62864----- seem to have made this bug more obvious as they both remove lines that reset moveReason.

      Looks like this is related to the changes introduced in ae01e0dbf50cb6da1967e10eb95d63313dc5aa7a (QTBUG-63026).

      import QtQuick 2.10
      import QtQuick.Window 2.10
      
      Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
      
        ListView {
          id: view
          anchors.fill: parent
          model: 10000
          cacheBuffer: 0
          keyNavigationEnabled: true
          focus: true
      
          delegate: Rectangle {
            id: delegate
            width: 300
            height: 30
            Text {
              anchors.centerIn: parent
              text: modelData
            }
            color: ListView.isCurrentItem ? "green" : "white"
            MouseArea {
              anchors.fill: parent
              onClicked: view.currentIndex = model.index
            }
          }
        }
      }
      

      Attachments

        For Gerrit Dashboard: QTBUG-67460
        # Subject Branch Project Status CR V

        Activity

          People

            srutledg Shawn Rutledge
            njeisecke Nils Jeisecke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes