[Interest] Qt5: How to detect difference between window closing and application quitting.

Till Oliver Knoll till.oliver.knoll at gmail.com
Sun Apr 5 11:25:35 CEST 2015



> Am 04.04.2015 um 22:12 schrieb Michael Jackson <imikejackson at gmail.com>:
> 
> I have a QMainWindow derived application on OS X (10.8.5 if is matters). This app was ported from Qt4 to Qt5 and now I seem to have an issue with my closeEven(..) being called twice. I have implemented the closeEvent(QCloseEvent* event) to capture when the window is closing so that I can call some clean up routines (Writing of settings files mainly). 

Would the signal

 http://doc.qt.io/qt-5/qguiapplication.html#lastWindowClosed

help instead of overwriting ::closeEvent?

You only get it if the /last/ main (top-level) window is (about to get) closed, but usually that is sufficient to write application settings (unless you want to also store window geometry, that is, /per window/).

Cheers,
 Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150405/84a93365/attachment.html>


More information about the Interest mailing list