Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.7.0
-
None
Description
When using Button as a left/right delegate, SwipeDelegate steals release events from the Button so its clicked() or released() gets never emitted:
import QtQuick 2.5 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 ApplicationWindow { id: window width: 360 height: 360 visible: true Shortcut { sequence: "Ctrl+Q" onActivated: Qt.quit() } ListView { anchors.fill: parent model: ListModel { id: listModel Component.onCompleted: { for (var i = 0; i < 100; ++i) append({text: "SwipeDelegate" + i}) } } delegate: SwipeDelegate { id: delegate width: parent.width text: model.text down: pressed || swipe.complete Switch { parent: delegate.contentItem anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter } swipe.right: Button { id: button x: parent.width - width height: parent.height contentItem: Label { text: "Remove" color: "white" horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter } background: Rectangle { color: button.pressed ? "darkred" : "red" } onPressedChanged: console.log("pressed", pressed) onPressed: console.log("pressed") onCanceled: console.log("canceled") // ### onReleased/onClicked never triggered: onReleased: console.log("released") onClicked: { console.log("clicked", index); listModel.remove(index, 1) } } ListView.onRemove: SequentialAnimation { PropertyAction { target: delegate; property: "ListView.delayRemove"; value: true } NumberAnimation { target: delegate; property: "height"; to: 0; easing.type: Easing.InOutQuad } PropertyAction { target: delegate; property: "ListView.delayRemove"; value: false } } } } }
Attachments
For Gerrit Dashboard: QTBUG-54648 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
164724,4 | SwipeDelegate: only consume child events if we grabbed the mouse | 5.7 | qt/qtquickcontrols2 | Status: MERGED | -2 | 0 |