![]() |
Catching close event
At my desktop in x11 when closing my app with the window button the aboutToQuit signal is called ... but in the Sailfish emulator it's not. Anyone else noticed this? The qml Component.onDestruction signal doesn't seem to work either, on desktop or emulator. Shouldn't aboutToQuit be called when closing app with the Sailfish UX? This could be a Wayland related problem but hopefully it's fixable.
|
Re: Catching close event
Quote:
|
Re: Catching close event
Hmm ok, and thanks for the fast answer. So I just wait until it's fixed then ... and hopefully the aboutToQuit signal too.
Edit: Or maybe you were talking about aboutToQuit because that one works with Item. |
Re: Catching close event
Quote:
|
Re: Catching close event
On the C++ side, you could install an event filter with "installEventFilter" on the QQuickView and look for the close event.
Code:
bool MyClass::eventFilter(QObject* obj, QEvent* ev) |
Re: Catching close event
I use python but I've not tried it like that. Even if it works, shouldn't the aboutToQuit signal work when closing from the Sailfish UX?
http://qt-project.org/doc/qt-5.1/qtc...ml#aboutToQuit "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." Or if the user closes the app from the window/UX. Edit: I got aboutToQuit to work in a small test code now so will try some more ... Edit2: It seems like aboutToQuit is called but the process is killed before the callback returns. Edit3: Hmm, I have one thing in the aboutToQuit callback that takes some time to return and the process is killed before that happens. It works on my desktop though. |
Re: Catching close event
Quote:
|
Re: Catching close event
It could well be that this is an SDK bug. There were changes made in how application closing happens quite some time ago that I am not completely sure have yet propagated into SDK releases (as they are lagging a bit behind our internal development for various reasons).
Once that is integrated, aboutToQuit should - to my knowledge - work OK, and the application will not be force-terminated unless it refuses to shut down when requested. Off the top of my head, anyway... |
Re: Catching close event
Ok, then we'll just sit tight and wait for a sdk update. :) I understand why you want to nuke the process on a mobile device but you should at least give the mainloop some time to return cleanly before doing so. But as you say it's probably fixed already and will be pushed to the next sdk update.
|
Re: Catching close event
Just as promised, the bug is fixed in todays sdk update. The process is not being killed before the mainloop returns. I just tested if a ten seconds sleep works and it did and that ought to be enough for anybody. :)
|
All times are GMT. The time now is 23:17. |
vBulletin® Version 3.8.8