-
Suggestion
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.15.1
-
None
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)
- duplicates
-
QTBUG-61783 SwipeDelegate left and right components not reacting on touchscreen press
-
- Closed
-