So you main looks like this?
int main(int argc, char**argv)
{
YourApplicationClass myAppObject; // something like a QMainWindow would be to a GUI app
return app.exec();
}
int main(int argc, char**argv)
{
QCoreApplication app;
YourApplicationClass myAppObject; // something like a QMainWindow would be to a GUI app
return app.exec();
}
To copy to clipboard, switch view to plain text mode
and your code is sitting in the exec() loop then you should be able to call:
QCoreApplication::exit(0); // it is static
To copy to clipboard, switch view to plain text mode
from anywhere in the main thread, or use a signal connected to QCoreApplication::quit().
If you are trying to terminate the application before line 5 is reached, then there is no event loop running. That means timers and queued signal/slot connections will not function: possibly the cause of the message in your option (a). If you cannot redesign your main() along usual Qt lines then you exit from this scenario by allowing execution to fall through to the exec() call with a flag set. If flag set then you never call exec().
Your option (b) is using the library function to summarily terminate the program. Its generally poor form to not clean up your threads, which is why the warning is issued by Qt.
Bookmarks