![]() |
Closing an application without killing main loop
Hi,
I'm writing an application which has to do dome network operations after user has closed the UI. Normally this is not possible, as the applications Qt main loop exits when closing the UI. On Harmattan i found a workaround - re-starting the mainloop by calling QGuiApplication::exec(). This seems to crash on Sailfish. The next workaround i tried to use is to create an event filter for the QGuiApplication and try to filter out the close event. QEvent::Close never happens, but QEvent::ApplicationDeactivate does. It can be used to prevent killing main loop, but unfortunately it also happens when user swipes the application to the background. Any ideas on how can i accomplish this? |
Re: Closing an application without killing main loop
It's not exactly what you're asking, but you could create a daemon and control it from your application via dbus, so you don't have to work around the close event.
|
Re: Closing an application without killing main loop
I think what you want is the aboutToQuit signal which doesn't quit the mainloop until its callback returns.
http://qt-project.org/doc/qt-5.0/qtc...ml#aboutToQuit |
Re: Closing an application without killing main loop
How about
Code:
app->setQuitOnLastWindowClosed(false); |
Re: Closing an application without killing main loop
Quote:
|
Re: Closing an application without killing main loop
Quote:
|
Re: Closing an application without killing main loop
Quote:
Code:
// Called when app about to quit - handle upsync & quitting Code:
virtual void ClientLogic::aboutToQuit() |
Re: Closing an application without killing main loop
why you need this? isnt better to rewrite logics?
set event filter, catch close event, do whatever. |
Re: Closing an application without killing main loop
Quote:
http://talk.maemo.org/showthread.php...ht=abouttoquit |
Re: Closing an application without killing main loop
Quote:
Quote:
I'd be even happy to write a patch to Qt or Sailfish itself if it is the only way and would be accepted into upstream. |
All times are GMT. The time now is 21:57. |
vBulletin® Version 3.8.8