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

SwipeDelegate left and right components not reacting on touchscreen press

    XMLWordPrintable

Details

    • 69162120c735801905893f90bef38b49464f6bb9, 0f4eb2320 (dev), 6105c2fc2 (6.6), 795686be3 (6.5)
    • G&UI Finishing 2023

    Description

      Using SwipeDelegate as explained in the example https://doc.qt.io/qt-5/qml-qtquick-controls2-swipedelegate.html#details does not react on cklick events on the left or right component.

      To test this, I ran the quickcontrols-gallery on the device an tried to click on remove in the Delegates section under SwipeDelegates. Same behaviour, nothing happens.

      Running both Applications on Windows or Linux x86(_64) with X-Server works like a charm.

      The main difference is that it works with the mouse, but not with the touch.

      import QtQuick 2.14
      import QtQuick.Controls 2.14
      
      ApplicationWindow {
          width: 400
          height: 400
          visible: true
          y: 600
      
          ListView {
              id: listView
              anchors.fill: parent
              model: ListModel {
                  ListElement { sender: "Bob Bobbleton"; title: "How are you going?" }
                  ListElement { sender: "Rug Emporium"; title: "SALE! All rugs MUST go!" }
                  ListElement { sender: "Electric Co."; title: "Electricity bill 15/07/2016 overdue" }
                  ListElement { sender: "Tips"; title: "Five ways this tip will save your life" }
              }
              delegate: SwipeDelegate {
                  id: swipeDelegate
                  objectName: "swipeDelegate"
                  text: model.sender + " - " + model.title
                  width: parent.width
      
                  ListView.onRemove: SequentialAnimation {
                      PropertyAction {
                          target: swipeDelegate
                          property: "ListView.delayRemove"
                          value: true
                      }
                      NumberAnimation {
                          target: swipeDelegate
                          property: "height"
                          to: 0
                          easing.type: Easing.InOutQuad
                      }
                      PropertyAction {
                          target: swipeDelegate
                          property: "ListView.delayRemove"
                          value: false
                      }
                  }
      
                  swipe.right: Label {
                      id: deleteLabel
                      objectName: "label"
                      text: qsTr("Delete")
                      color: "white"
                      verticalAlignment: Label.AlignVCenter
                      padding: 12
                      height: parent.height
                      anchors.right: parent.right
      
                      SwipeDelegate.onClicked: listView.model.remove(index)
                      SwipeDelegate.onPressedChanged: print("SwipeDelegate.pressed", SwipeDelegate.pressed)
      
                      background: Rectangle {
                          objectName: "labelBgRect"
                          color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
                      }
                  }
              }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              mfuerst Marc Führst
              Votes:
              8 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: