[Interest] Triggering Actions on Application Close

andy fillebrown andy.fillebrown at gmail.com
Tue Jul 9 06:03:35 CEST 2013


I think the problem might be the use of the "Force quit" button.  That is
not a normal way to close an application.  Pressing the "Force quit" button
is similar to using the OS to kill the process. I'd be surprised if any
slots were called in that case.  Try closing the application like a normal
user would.

Cheers,
~ andy.f





On Mon, Jul 8, 2013 at 9:11 PM, Syam Krishnan <syamcr at gmail.com> wrote:

> On 07/09/2013 04:03 AM, Mitchell Verter wrote:
> > How do I trigger cleanup actions on application close?
> >
> > I need to write out temporary objects and a footer to a file whenever
> > the Application is closed.
> >
> > I've tried several approaches, but none of them produces any result
> > when I "Force Quit" by hitting the red button within QtCreator.
> >
> > More specifically, I have tried to connect:
> >
> >      QObject::connect(&myApplication, SIGNAL(aboutToQuit()),
> > &myMainWindow,  SLOT(closeFileSlot()));
> >
> > (note that I am using a QApplication rather than a QCoreApplication --
> > I'm not sure if it makes a difference)
>
>
> You could try the signal QApplication::lastWindowClosed() or override
> the closeEvent() function of your QMainWindow class.
>
> regards,
>
> Syam
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130709/9d180588/attachment.html>


More information about the Interest mailing list