Originally Posted by
Doug Broadwell
How can I get an initialization function to run once "return( app.exec )" is run?
This does not make much sense... But I guess you probably meant once app.exec() is run and before it returns otherwise it wouldn't be an initialization function and would be as simple as that :
int retcode = app.exec();
someCleanupFunction();
int retcode = app.exec();
someCleanupFunction();
To copy to clipboard, switch view to plain text mode
However if you need initializations to be done the function as to be called after the QApplication object is created (or instanciations of painting related classes will fail) and, depending of whether they need an running event loop or not...
staticInitFunction();
SomeDynamicInitObject dynamicInitObject;
QTimer::singleShot(0,
&dynamicInitObject,
SLOT( dynamicInitFunction
() );
return app.exec();
QApplication app;
staticInitFunction();
SomeDynamicInitObject dynamicInitObject;
QTimer::singleShot(0, &dynamicInitObject, SLOT( dynamicInitFunction() );
return app.exec();
To copy to clipboard, switch view to plain text mode
Bookmarks