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

[SwipeDelegate] Click events not working on touch devices

    XMLWordPrintable

Details

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

    Description

      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)

      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
              freed Igor Bugaev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes