Important: Please read the Qt Code of Conduct -

delete Item and load another on the same ApplicationWindow

  • Hey,
    I have this Application which shows an Item and on ButtonClick it loads another qml file.

    My Question is how do I close/delete "rootItem" instead of only set

    rootItem.visible = false

    because I dont need it anymore after the Button is clicked.

    ApplicationWindow  {
            id: mainWindow
            Item {
               id: rootItem
               Button {
                   id: okButton
                   text: "OK"
                   onClicked: { coreApp.receiveOkButtonClick() }
                target: coreApp
                onLoadPage: {
                   var component
                   var connectionPage
                   component = Qt.createComponent( "qrc:/Page.qml" )
                   rootItem.visible = false
                   connectionPage = component.createObject( mainWindow )

Log in to reply