How to access myApp->method from a child
Excuse a very basic question:
What is the syntax for accessing a method in the main myApp class from a child object?
To clarify:
My main document application class myApp has a method getConfigData, needed by a child document class myDocument. From inside the myDocument class, how should I call getConfigData?
Simple, but I can't find it.
Re: How to access myApp->method from a child
one way is:
#include "your-app.h"
Code:
static_cast<YourApp*>(qApp)->getConfigData()
Of course, that is not the only way.
If the method is static, or your app class a singleton there are easier ways.
HTH
Re: How to access myApp->method from a child
Thanks,
Yes, myApp should have only one instance (how do I ensure this?) , so if there is a more simple method I would be interested.
The app is a document app with some common resources to be used by the child documents.