Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.7.0
-
None
-
d49ab00f2b9c99da48d9ddef2b0627a86d54b95e
Description
It should be possible to apply scale/opacity etc. animations on the left/right/behind items based on the position of the swipe. The problem is that when a swipe is released or when swipe.close() is called, even though SwipeDelegates own visuals animate, anything bound to SwipeDelegate::position doesn't. SwipeDelegate should run a transition on the position to make things animate as appropriate.
import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 ApplicationWindow { width: 300 height: 400 visible: true ListView { model: 10 anchors.fill: parent delegate: SwipeDelegate { id: delegate text: index width: parent.width swipe.left: Rectangle { width: parent.width height: parent.height color: Material.color(Material.Green, SwipeDelegate.pressed ? Material.Shade700 : Material.Shade500) Label { text: "Left" color: "white" anchors.margins: 10 anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter scale: delegate.swipe.position // <== } SwipeDelegate.onClicked: delegate.swipe.close() } swipe.right: Rectangle { width: parent.width height: parent.height anchors.right: parent.right color: Material.color(Material.Red, SwipeDelegate.pressed ? Material.Shade700 : Material.Shade500) Label { text: "Right" color: "white" anchors.margins: 10 anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter scale: -delegate.swipe.position // <== } SwipeDelegate.onClicked: delegate.swipe.close() } } } }
Attachments
For Gerrit Dashboard: QTBUG-57242 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
178072,9 | SwipeDelegate: transition swipe.position | dev | qt/qtquickcontrols2 | Status: MERGED | -2 | 0 |