Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Catching close event

    Reply
    xerxes2 | # 1 | 2013-10-14, 13:47 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to xerxes2 For This Useful Post:
    Wikiwide

     
    marmistrz | # 2 | 2013-10-14, 13:53 | Report

    Originally Posted by xerxes2 View Post
    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.
    It's a bug. If you use Item instead of ApplicationWindow it works. Otherwise it's aborted. Look here: https://lists.sailfishos.org/piperma...er/000723.html

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to marmistrz For This Useful Post:
    Wikiwide, xerxes2

     
    xerxes2 | # 3 | 2013-10-14, 14:06 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by xerxes2; 2013-10-14 at 14:28.
    The Following User Says Thank You to xerxes2 For This Useful Post:
    Wikiwide

     
    marmistrz | # 4 | 2013-10-14, 15:08 | Report

    Originally Posted by xerxes2 View Post
    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.
    I was talking about Component.onDestruction

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to marmistrz For This Useful Post:
    Wikiwide, xerxes2

     
    pycage | # 5 | 2013-10-14, 16:27 | Report

    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)
    {
        if (obj == myView && ev->type() == QEvent::Close)
        {
            // do something...
        }
        return QObject::eventFilter(obj, ev);
    }

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to pycage For This Useful Post:
    Wikiwide, xerxes2

     
    xerxes2 | # 6 | 2013-10-14, 20:27 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by xerxes2; 2013-10-14 at 21:35.
    The Following 2 Users Say Thank You to xerxes2 For This Useful Post:
    Rauha, Wikiwide

     
    marmistrz | # 7 | 2013-10-15, 13:54 | Report

    Originally Posted by xerxes2 View Post
    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.
    just post jolla mailing list about it and hope theyll fix it.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to marmistrz For This Useful Post:
    Wikiwide, xerxes2

     
    w00t | # 8 | 2013-10-17, 21:56 | Report

    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...

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 6 Users Say Thank You to w00t For This Useful Post:
    ajalkane, marmistrz, mattaustin, Rauha, Wikiwide, xerxes2

     
    xerxes2 | # 9 | 2013-10-20, 10:10 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to xerxes2 For This Useful Post:
    Wikiwide

     
    xerxes2 | # 10 | 2013-10-22, 19:28 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 6 Users Say Thank You to xerxes2 For This Useful Post:
    marmistrz, mattaustin, miqu, pycage, Rauha, rcolistete

     
vBulletin® Version 3.8.8
Normal Logout