StackView issue when "StackView.Immediate" is used.
Unsolved
QML and Qt Quick
-
I am getting following error "ReferenceError: stack is not defined" when i clicked on back to 1 button and not getting any error when i clicked on back to 2 button .
I will not get any error if i removed "StackView.Immediate", Below is the code:
import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 2.2 Window { visible: true width: 640 height: 480 title: qsTr("Stack view") MainForm { property alias stack:stack StackView { id: stack width: 360 height: 360 initialItem: comp1 } Component { id:comp1 Rectangle { id: page1 color: "lightgreen" Button { id: buttonPage1 text: "back to 2" anchors.centerIn: parent onClicked: { stack.pop(StackView.Immediate) stack.push(comp2, StackView.Immediate) } } TextEdit { id: te1 width: 105 height: 40 text: "enter" } } } Component { id:comp2 Rectangle { id: page2 color: "lightblue" Button { id: buttonPage2 text: "back to 1" anchors.centerIn: parent onClicked: { stack.pop(StackView.Immediate) stack.push(comp1,StackView.Immediate) } } TextEdit { id: te2 width: 109 height: 29 text: "enter" } } } } }