I have an application with several pages. One of them is a settings page where the user can select various settings. There are various buttons on the pages with which I can open the different pages.
Currently I always switch between the pages with:
page.navigationStack.push(nameOfPage)
For most cases this is okay, but when I close the settingspage, I want to go back to the previous page (the page that was opened when I pressed the button to open settingspage) and not have to specify 1 page.
I am working with QML/Felgo
code example: import Felgo 3.0 import QtQuick 2.0 import QtQuick.Controls 1.4
App {
id: app
NavigationStack {
Page {
id: page
navigationBarHidden: true
Text { text: qsTr("1st page") }
Button {
y: 30; text: "go to 2nd page"
onClicked: page.navigationStack.push(secondpage)
}
Button {
y: 60; text: "go to settings"
onClicked: page.navigationStack.push(settingsPage)
}
}
}
Component {
id: secondpage
Page {
navigationBarHidden: true
Text { text: qsTr("2nd page") }
Button {
y: 30; text: "go to 1st page"
onClicked: page.navigationStack.push(page)
}
Button {
y: 60; text: "go to settings"
onClicked: page.navigationStack.push(settingsPage)
}
}
}
Component {
id: settingsPage
Page {
navigationBarHidden: true
Text { text: qsTr("settings page") }
//various settings
Button {
y: 30; text: "go to previous page"
onClicked: page.navigationStack.push(page) //??
}
}
}
}
i dont know what to put for line 47 - so that I can get to either 1st or 2nd page - depending on where I opened settingspage from
any help would be really appreciated