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

ListView.snapMode doesn't work correctly with header item.

    XMLWordPrintable

    Details

    • Platform/s:
      Windows

      Description

      import QtQuick 2.12
      import QtQuick.Controls 2.5
      
      Item {
          id: root
          width: 640
          height: 480
      
          ListView {
              id: list
              anchors.fill: parent
              model: 10
              header: Rectangle {
                  width: 640
                  height: 50
                  color: "green"
                  z: 11
                  opacity: 0.5
              }
              headerPositioning: ListView.OverlayHeader
              spacing: 50
              snapMode: ListView.SnapToItem
              delegate: Rectangle {
                  width: 640
                  height: 100
                  color: "red"
              }
          }
      
          Button {
              font.pixelSize: 20
              text: list.contentY.toFixed(0)
              onClicked: {
                  list.returnToBounds()
              }
          }
      }
      

      On start list.contentY is equal to -50 (header height).
      Steps:
      Scroll the list so that the contentY is between -50 and 75
      Observed result:
      Nothing happens (Calling returnToBounds() also does nothing.)
      item overlaps by header item.
      *Expected result: *
      The ListView settles with a item aligned with the beginning of the ListView (or with the end of header item).

      Should the items align with the beginning of the ListView or with the end of the header Item, when headerPositioning: ListView.OverlayHeader? What is the expected behavior?

        Attachments

          Issue Links

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

            Activity

              People

              • Assignee:
                smd Jan Arve
                Reporter:
                evgeniy_kolchin Kolchin Evgeny
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Gerrit Reviews

                  There is 1 open Gerrit change