0
votes

I know how to push a screen from my main screen by calling that main screen's NavigationPane object's push(newScreen) method.

Now what if I want to push another screen on top of the second one?? Do I have to get my NavigationPane to push it?? If so, how can I access my mainscreen's NavigationPane from my second screen(they are in separate files)?? I guess the same would apply for a third or fourth screen.

Also for popping screens, how do I get my second(or third) screen to pop itself?? This is assuming I have no back button, I would like to do this programmatically. Do I have to somehow get a reference to my mainscreen's NavigationPane?? And like in the first question, how can I do this??

All examples I've seen on the matter were QML examples, I need to know how to do this in C++ (no QML at all).

Any help at all (links, code snippets) would be greatly appreciated.

1

1 Answers

2
votes
  • You can use a class for each page, where you pass the NavigationPane in the constructor. Take care not to extends the Page (it will not work), but instead use a factory class that will create the Page. This class could also contains all Q_INVOKABLE, etc, to communicate with the QML

  • You can set the NavigationPane as the parent of the Page and cast it later with the method parent()

  • You can set the NavigationPane as a property of the Page to retrieve it later.

  • You can use a singleton or a static variable to stock the NavigationPane