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

SwipeDelegate not always emits swipe.complete

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.7.0
    • Fix Version/s: 5.7.1
    • Component/s: Quick: Controls 2
    • Labels:
      None
    • Environment:
      Android, iOS

      Description

      tried out some more complex layouts for swipe.behind.
      Sometimes the swipe position never becomes 1.0 - 0nly something around +-0.85 or so.
      Example below (thx to J-P) works: position 0 (complete) correct reported

      Uncomment the Pane in swipe.behind and it never reports position 1

      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
      
          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
      
                  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:
      //                Pane {
      //                padding: 0
      //                width: parent.width
      //                height: parent.height
                      Label {
                          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 }
                  }
              }
          }
      }
      

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              mitch_curtis Mitch Curtis
              Reporter:
              ekkescorner Ekkehard
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes