[Interest] [Android] QMainWindow::closeEvent not raised when user terminates with swipe?

Robert Iakobashvili coroberti at gmail.com
Tue Apr 7 17:27:16 CEST 2015


On Tue, Apr 7, 2015 at 6:05 PM, Eddie Sutton <edsutton at gmail.com> wrote:
> Currently I save QSettings in closeEvent.
>
> On Android this event is not raised when user presses that Android square icon, then swipes app window to close.
>
> How do I handle saving work user may have been editing?
>
> -Ed

Hi Ed,
Look at QGuiApplication::applicationStateChanged signal.
When your app transits from
Qt::ApplicationActive to anything else (Qt::ApplicationSuspended or
Qt::ApplicationInactive),
it's worth to save everything; next user can swipe it out.

It looks to be a rather cross-platform way,
and it may work for iOS as well.

Take care!

Regards,
Robert



More information about the Interest mailing list