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

[SwipeDelegate] Click events not working on touch devices

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.15.1
    • Quick: Controls 2
    • None
    • Android, iOS/tvOS/watchOS

      Try to run example code - https://doc.qt.io/qt-5/qml-qtquick-controls2-swipedelegate.html

      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
              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
                  text: qsTr("Delete")
                  color: "white"
                  verticalAlignment: Label.AlignVCenter
                  padding: 12
                  height: parent.height
                  anchors.right: parent.right
      
                  SwipeDelegate.onClicked: listView.model.remove(index)
      
                  background: Rectangle {
                      color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
                  }
              }
          }
      }
      

      Event SwipeDelegate.onClicked is never emitted on touch devices (tested on android and iOS devices). But when you run this example at platforms with mouse events, all worked fine. (tested at MacOS/Windows/Linux)

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            freed Igor Bugaev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes