high_flyer
29th December 2007, 01:37
Hi All,
I have this very simple console application, which basically runs with a polling timer, reads data, and saves it into a file.
Since its a console program, it can be terminated (only) by Ctrl+C, which is no problem.
However, I want to gracefully end my application in such a case, and write a closing tag in my data file.
From the docs, I thought that QCoreApplication::aboutToQuit() is my friend.
This signal is emitted when the application is about to quit the main event loop, e.g. when the event loop level drops to zero. This may happen either after a call to quit() from inside the application or when the users shuts down the entire desktop session.
The signal is particularly useful if your application has to do some last-second cleanup. Note that no user interaction is possible in this state.
But the slot connected to it does not run (or not being called) when the application is terminated with Ctrl+C.
I checked for mistyping signal/slot names, all seems to be "kosher" during build time.
Any idea how to achieve what I want, or what I might be missing?
Thanks.
Oh, this one is on Windows, with MinGW, Qt4.3.1
I have this very simple console application, which basically runs with a polling timer, reads data, and saves it into a file.
Since its a console program, it can be terminated (only) by Ctrl+C, which is no problem.
However, I want to gracefully end my application in such a case, and write a closing tag in my data file.
From the docs, I thought that QCoreApplication::aboutToQuit() is my friend.
This signal is emitted when the application is about to quit the main event loop, e.g. when the event loop level drops to zero. This may happen either after a call to quit() from inside the application or when the users shuts down the entire desktop session.
The signal is particularly useful if your application has to do some last-second cleanup. Note that no user interaction is possible in this state.
But the slot connected to it does not run (or not being called) when the application is terminated with Ctrl+C.
I checked for mistyping signal/slot names, all seems to be "kosher" during build time.
Any idea how to achieve what I want, or what I might be missing?
Thanks.
Oh, this one is on Windows, with MinGW, Qt4.3.1