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

StackView's depth is not updating after clear()

    XMLWordPrintable

Details

    • iOS/tvOS/watchOS, macOS
    • 838b9ee9f (dev), bc02757b1 (6.5), 2ec9fac28 (tqtc/lts-6.2)

    Description

      StackView's onDepthChanged does not execute after calling clear() if Transition been specified. If I do call clear() without parameters then onDepthChanged executes (depth become 0) as expected.

      import QtQuick 2.14
      import QtQuick.Controls 2.14
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          Rectangle {
              color: "yellow"
              anchors.fill: parent
      
              Button {
                  text: "push green view"
                  anchors.centerIn: parent
                  onClicked: {
                      stackView.push(swipeComponent)
                  }
      
                  width: 300
                  height: 100
              }
          }
      
          StackView {
              anchors.fill: parent
              id: stackView
      
              onDepthChanged: {
                  print("depth changed to " + depth)
              }
          }
      
          Component {
              id: swipeComponent
      
              Rectangle {
                  color: "green"
                  Button {
                      text: "pop green view"
                      anchors.centerIn: parent
                      onClicked: {
                          // NOTE: If you do swipeView.clear() then you can see log message "depth changed to 0"
                          // But if you do swipeView.clear(StackView.PopTransition) then you can't
                          stackView.clear(StackView.PopTransition)
                      }
                  }
              }
          }
      }
      

      Attachments

        1. main.qml
          1 kB
        2. sandbox.tgz
          1 kB
        For Gerrit Dashboard: QTBUG-84920
        # Subject Branch Project Status CR V

        Activity

          People

            vhilshei Volker Hilsheimer
            sergeikolchanov Sergey Kolchanov
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes