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

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

    XMLWordPrintable

Details

    • Windows
    • 01660fbb67c39c74b2e1eeae1e3d1b97c8886cdb (qt/qtdeclarative/5.14) e9b4fac4e1765ea8789b17948a0a22fad7db50c0 (qt/qtdeclarative/5.12)

    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

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

          Activity

            People

              smd Jan Arve
              evgeniy_kolchin Kolchin Evgeny
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes