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

Adding header on ListView prevents scrolling on mobile when the delegate has MouseArea

    XMLWordPrintable

Details

    • Android

    Description

      Problem

      On mobile (Tested with a Mi A2 Lite, android 10) when a ListView has a header with e.g. ListView.PullBackHeader headerPositioning, you are not able to scroll the list. If you set the header width half of the main width, you can scroll on the half side where the header isn't shown.

      Minimal test setup

      import QtQuick 2.15
      import QtQuick.Controls 2.15
      
      ApplicationWindow {
          id: root
          visible: true
      
          ListView{
              anchors.fill: parent
              width: parent.width
              height: parent.height
              model: 100
              boundsBehavior: Flickable.StopAtBounds
              headerPositioning: ListView.PullBackHeader
              header: Rectangle{
                  width: root.width
                  height: 200
                  color: "green"
              }
      
              delegate: Rectangle{
                  width: ListView.view.width
                  height: 20
      
                  MouseArea{
                      anchors.fill: parent
                      onClicked: console.log("clicked")
      
                      Text{
                          anchors.centerIn: parent
                          text: qsTr("Element %1").arg(index)
                      }
                  }
              }
          }
      }
      

      Attachments

        Issue Links

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              jd42 jd42
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: