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

Pushed item after StackView::clear() has wrong x coordinate.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.7.0 Beta
    • Quick: Controls 2
    • None

    Description

      When I clear stack and then push item here, it doesn't displayed. If it use replace() instead or push Component instead of Item, it works.

      The item is visible, has proper parent and dimensions. It is also currentItem of the stack, but after clear() it has wrong x coordinate which doesn't change after push.

      To reproduce, run test program, click on "switch", then click on "back".

      import QtQuick 2.6
      import QtQuick.Controls 2.0
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          StackView {
              id: stackView
      
              anchors.fill: parent
              initialItem: first
          }
      
          Rectangle {
              id: first
      
              color: "green"
              onXChanged: console.log(x)
          }
      
          Component {
              id: second
      
              Rectangle {
                  color: "blue"
              }
          }
      
      
          footer: Row {
              spacing: 10
      
              Button {
                  text: "switch"
                  onClicked: stackView.replace(null, second)
              }
      
              Button {
                  text: "back"
      //            onClicked: stackView.replace(null, first)
                  onClicked: {
                      stackView.clear()
                      stackView.push(first)
                  }
              }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              krnekit Nikita Krupenko
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes