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

SwipeDelegate Layouting problem if orientation changes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.7.1
    • 5.7.0
    • Quick: Controls 2
    • 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 }
                  }
              }
          }
      }
      
      

      Attachments

        1. swipe_01.png
          swipe_01.png
          216 kB
        2. swipe_02.png
          swipe_02.png
          208 kB
        3. swipe_03.png
          swipe_03.png
          172 kB
        4. swipe_04.png
          swipe_04.png
          148 kB
        5. swipe_05.png
          swipe_05.png
          229 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mitch_curtis Mitch Curtis
            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