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

SwipeDelegate: calling swipe.close() breaks the internal state

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.8.0 RC
    • 5.8.0 Beta
    • Quick: Controls 2
    • None
    • 08ba34d6a8cf7e7ab21ce51ca6aa7d812d035a67

    Description

      After calling swipe.close(), the next swipe starts with a wrong offset.

      Steps to reproduce:

      • swipe open to the left or right
      • click the left or right side item
        => swipe delegate closes
      • try swiping the same item again
      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
                      }
      
                      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
                      }
      
                      SwipeDelegate.onClicked: delegate.swipe.close() // <==
                  }
              }
          }
      }
      

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            jpnurmi J-P Nurmi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes