Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.7.0
-
None
-
Android
Description
just noticed a problem if screen orientation changes
please follow the comments on the screenshots
starting in Portrait, swipe to 1.0
change into Landscape
swipe.behind changes width
foreground fragments visible
the other way:
starting swipe to 1.0 in Landscape
rotate to Portrait
swipe back
now parts of foreground is outside and not visible
import QtQuick 2.5 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 import QtQuick.Layouts 1.3 ApplicationWindow { id: window width: 360 height: 360 visible: true 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 onClicked: { console.log("CLICK at "+swipe.position) if (swipe.complete) listModel.remove(index) } Switch { parent: delegate.contentItem anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter } swipe.behind: Label { Layout.fillWidth: true text: "Remove" color: "white" width: parent.width height: parent.height horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter background: Rectangle { color: Material.color(Material.Red, delegate.pressed ? Material.Shade800 : Material.Shade500) } } 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 } } } } }