I am writing a Qt application and have run into the following problem: when the user logs out or attempts to shut down the machine, the application is instantly terminated without providing it any chance to save any data. I assume the app needs to listen for some event. I tried listening for the
SIGTERM signal, but my application was still terminated before it had a chance to respond to the signal.
What options do I have?