07-08-2013 11:09 AM - edited 07-08-2013 11:18 AM
I would like to know how to get a reference to the current Application through code. I would like to be able to access my NavigationPane on my applications main screen from anywhere in my code so that I can push and pop screens.
I guess I'm trying to do something like:
Or am I going about the pushing and popping the wrong way? I undertsand the idea of pushing and popping screens from a NavigationPane, I would just like to know how to do this from any screen.
07-08-2013 12:08 PM
If you look at the class hierarchy, above bb::cascades::Application you'll get to bb::Application and then QCoreApplication, where there's an instance() static method that does what you want.
07-08-2013 12:22 PM - edited 07-08-2013 12:24 PM
Could you show me an example of how I would create the reference??
Something like this??:
QCoreApplication *instanceOfApp = QCoreApplication.instance();
This doesn't work though.
07-08-2013 12:24 PM
07-08-2013 12:26 PM
07-08-2013 12:27 PM - edited 07-08-2013 12:46 PM
Sorry about not providing more info, it was a syntax error:
error: expected primary-expression before '.' token
I was trying to use the dot operator where I shoud've used ::
It seems to be working so far. Thanks alot for your help!