Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.0 Beta
-
None
-
Mageia Linux Cauldron, x86_64, gcc 5.3.1
-
cf58057988464f68e23c4d52598fd9de791f4af7
Description
If I replace the topmost item in the stack, all items that was in the stack are deleted from the stack.
To reproduce, run test program and click on "Replace" button. It replaces the topmost item with the new item. Then click on "Pop" button. The first item should be displayed, but nothing happens.
import QtQuick 2.5 import QtQuick.Layouts 1.3 import Qt.labs.controls 1.0 ApplicationWindow { visible: true width: 640 height: 480 Component { id: firstComponent Item { Text { anchors.centerIn: parent text: "The first item" } } } Component { id: secondComponent Item { Text { anchors.centerIn: parent text: "The second item" } } } Component { id: newComponent Item { Text { anchors.centerIn: parent text: "The new item" } } } ColumnLayout { anchors.fill: parent spacing: 10 StackView { id: stackView Layout.fillHeight: true Layout.fillWidth: true onDepthChanged: console.log("depth:", depth) } Row { Layout.alignment: Qt.AlignHCenter spacing: 10 Button { text: "Replace" onClicked: stackView.replace(stackView.get(1), newComponent) } Button { text: "Pop" onClicked: stackView.pop() } } } Component.onCompleted: stackView.push([ firstComponent, secondComponent ]) }