Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. StackView issue when "StackView.Immediate" is used.
Forum Update on Monday, May 27th 2025

StackView issue when "StackView.Immediate" is used.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlqtquick2stackviewqtquick.control
1 Posts 1 Posters 696 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pra7
    wrote on 25 Jul 2017, 16:57 last edited by pra7
    #1

    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"
                    }
                }
            }
        }
    }
    
    
    1 Reply Last reply
    0

    1/1

    25 Jul 2017, 16:57

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved