0

I have two QML files

Level1.qml and level2.qml

in main.qml,

    StackView {
        id: idMyStackView
        focus: true
        anchors.fill: parent
        initialItem: Level1{
                focus: true
            }
    }

in Level1.qml

    Component.onCompleted:
    {
        idMyStackView.push(idLevel2.qml)
    }

In this case I am getting error like

W] (file:///C:/Qt/5.13.0/msvc2017/qml/QtQuick/Controls/StackView.qml:790) Warning: StackView: You cannot push/pop recursively! [D] (file:///C:/Qt/5.13.0/msvc2017/qml/QtQuick/Controls/StackView.qml:791) __recursionGuard (file:///C:/Qt/5.13.0/msvc2017/qml/QtQuick/Controls/StackView.qml:791) push (file:///C:/Qt/5.13.0/msvc2017/qml/QtQuick/Controls/StackView.qml:568) onCompleted (qrc:/setup/qml/setup_menu/setup_top/SetupTop.qml:250) __loadElement (file:///C:/Qt/5.13.0/msvc2017/qml/QtQuick/Controls/StackView.qml:825) __performTransition (file:///C:/Qt/5.13.0/msvc2017/qml/QtQuick/Controls/StackView.qml:911) push (file:///C:/Qt/5.13.0/msvc2017/qml/QtQuick/Controls/StackView.qml:605) expression for onCompleted (file:///C:/Qt/5.13.0/msvc2017/qml/QtQuick/Controls/StackView.qml:777)

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Vipin
  • 3
  • 1
  • 1
    Why are you pushing a second item on the stack during the operation of pushing the first item? – JarMan Sep 08 '20 at 20:20
  • In some special cases I need to push Level2 on top of Level 1. Level2 has some dependency with level1. so pushing level2 only is not possible – Vipin Sep 09 '20 at 04:41
  • did you try calling idMyStackView.push(idLevel2.qml) in your main.qml instead of Level1 – luffy Sep 09 '20 at 11:09
  • *"Level2 has some dependency with level1"* - This sounds like a design flaw. – JarMan Sep 09 '20 at 15:45

0 Answers0