I'm not sure what's doing this but I think it's when I want the app to close abruptly (for example when the user chooses not to continue after an SSL error the application will close) using the method exit(EXIT_FAILURE);
.
I have noticed that there are multiple system tray icons, one for each time I have run my application.
Will the exit(EXIT_FAILURE);
cause this? Is there anyway to properly dispose of the system tray object?
Thanks
If you want to exit, it's probably best to ask Qt do to it, so it can clean up after itself.
From anywhere in your code, call qApp->quit() or QApplication::quit(). (qApp is global) You can also use exit().
#include <QApplication>
to access.
You can pass 'EXIT_FAILURE' to exit():
#include <QApplication>
QApplication::exit(EXIT_FAILURE)
If you're not using the Qt GUI, QCoreApplication has the same function:
#include <QCoreApplication>
QCoreApplication::exit(EXIT_FAILURE)
Note that exit() and quit() don't immediantly close your program, but end your original call to application.exec(). On some platforms, and in some cases, exec() won't return, and on others it will.
The difference between quit() and exit(), is that quit() is a slot for signals and slots, and quit() just calls exit(0).