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

Using GridView.SnapToRow and GridView.ApplyRange with a top margin leads to view jumps

    XMLWordPrintable

Details

    • e44843bfc8fc8bfd5c987fde08816ec3d81f0cae

    Description

      The following example demonstrates the issue. Click the black button to see the view jump before smoothly transitioning. Changing the highlightRangeMode to NoHighlightRange or StrictlyEnforceRange fixes the issue.

      import QtQuick 2.0
      
      GridView {
          id: gridView
          width: 400; height: 400
          cellHeight: height/ 3
          cellWidth: width / 5
          model: 30
      
          topMargin: 50
          snapMode: GridView.SnapToRow
          preferredHighlightBegin: 50
          preferredHighlightEnd: 50
          highlightRangeMode: GridView.ApplyRange
      
          delegate: Rectangle {
              width: gridView.cellWidth
              height: gridView.cellHeight
              color: index % 3 == 0 ? "#00FF00" : index % 2 == 0 ? "#FFFF00" : "#0000FF"
          }
      
          highlight: Rectangle { color: "red"; z: 2 }
          highlightMoveDuration: 1000
      
          Rectangle {
              id: scrollbar
              y: gridView.visibleArea.yPosition * gridView.height
              width: 10
              height: gridView.visibleArea.heightRatio * gridView.height
              color: "black"
          }
      
          Rectangle {
              width: 50; height: 50
              color: "black"
              anchors.right: parent.right
              anchors.bottom: parent.bottom
      
              MouseArea {
                  anchors.fill: parent
                  onClicked: gridView.currentIndex = gridView.currentIndex + 5
              }
          }
      }
      

      Attachments

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

        Activity

          People

            mbrasser Michael Brasser
            mbrasser Michael Brasser
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes