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

Mouse-click catch in QML Listview's header with clip = true

    XMLWordPrintable

Details

    • All
    • 6857ad3e686a5e2b45d28a7f47dca3210608da50 (qt/qtdeclarative/dev) 2acb31641fc9c34d24ac29232cdfec2673834629 (qt/qtdeclarative/5.15)

    Description

      In QML I have a ListView with a header catching mouse events. If the ListView has the property clip = true and headerPositioning = ListView.OverlayHeader the mouse events are not catched.

      With clip = false, it behaves as expected.

      The same happens with the footer.

      In Qt 5.13 it behaves as expected.

      Example:

      import QtQuick 2.9
      import QtQuick.Layouts 1.15
      import QtQuick.Window 2.15
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          ListModel {
              id: myModel
              ListElement { name: "Element 1"}
              ListElement { name: "Element 2"}
              ListElement { name: "Element 3"}
              ListElement { name: "Element 4"}
              ListElement { name: "Element 5"}
              ListElement { name: "Element 6"}
          }
      
          ListView {
              anchors.fill: parent
              model: myModel
              clip: true
              headerPositioning: ListView.OverlayHeader
              footerPositioning: ListView.OverlayHeader
      
              delegate: Text {
                  height: 100
                  text: name
              }
      
              header: Rectangle {
                  width: parent.width
                  height: 50
                  z: 2
                  color: "blue"
                  MouseArea {
                      anchors.fill: parent
                      onClicked: {
                          console.log("header onClicked")
                      }
                  }
              }
              footer: Rectangle {
                  width: parent.width
                  height: 50
                  color: "red"
                  z: 2
                  MouseArea {
                      anchors.fill: parent
                      onClicked: {
                          console.log("footer onClicked")
                      }
                  }
              }
          }
      }
      
      

       

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              frederic Frédéric Bourgeois
              Votes:
              3 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews