Program central hub of information. More...
#include <application.h>
Public Member Functions | |
bool | isRunning () const |
Plugins and other threads can use this to figure out if program is closing. More... | |
MainWindow * | mainWindow () const |
MainWindow of the program. More... | |
QWidget * | mainWindowAsQWidget () const |
Returns MainWindow as a QWidget. More... | |
void | setMainWindow (MainWindow *mainWindow) |
void | stopRunning () |
Makes isRunning() return false. More... | |
Static Public Member Functions | |
static void | deinit () |
Deinitializes the program; executed when program is shutting down. More... | |
static void | init (int &argc, char **argv) |
static Application * | instance () |
static bool | isInit () |
Program central hub of information.
Accessors provide plugins with certain objects and data that is not encapsulated in any singleton. Calling any non-const method from plugin perspective may result in undefined behavior of the program or even other plugins.
Definition at line 44 of file application.h.
|
static |
Deinitializes the program; executed when program is shutting down.
Doesn't delete the actual instance() but calls destroy() method.
That way certain data fields can still be accessed after the program is deinitialized. Actual instance is never deleted explicitly, and OS will clear the memory anyway.
Definition at line 51 of file application.cpp.
bool Application::isRunning | ( | ) | const |
Plugins and other threads can use this to figure out if program is closing.
Threads should exit their loops and let the program close gracefully.
Definition at line 81 of file application.cpp.
MainWindow * Application::mainWindow | ( | ) | const |
MainWindow of the program.
Might be NULL if current run doesn't create a MainWindow.
Definition at line 86 of file application.cpp.
QWidget * Application::mainWindowAsQWidget | ( | ) | const |
Returns MainWindow as a QWidget.
Useful for plugins that need to specify parent widget for dialog boxes or such, as MainWindow class itself is not exported.
Might be NULL if current run doesn't create a MainWindow.
Definition at line 91 of file application.cpp.
void Application::stopRunning | ( | ) |
Makes isRunning() return false.
Called when program is shutting down.
Definition at line 101 of file application.cpp.