ApplicationWindow.overlay HowTo detect Popup created (QQC2)


  • Qt Champions 2016

    Opening a modal Popup or Dialog, it will be created on top of ApplicationWindow.overlay
    http://doc.qt.io/qt-5/qml-qtquick-controls2-applicationwindow.html#overlay-prop

    ApplicationWindow.overlay has ApplicationWindow.overlay.modal and ...modeless properties (Component)

    Is there a way to check if a modal Popup is opened on top of ApplicationWindow.overlay ?

    would be great to disable the Android Back key



  • Out of curiosity, have you tried how the Back key behaves with popups in Qt 5.8? I recall that we did some work in that area, to make it work similarly than the Esc key works on desktop. Also the QML Shortcut type should now respect modal popups.


  • Qt Champions 2016

    @jpnurmi thx for the info - will test this next days.


  • Qt Champions 2016

    @jpnurmi said in ApplicationWindow.overlay HowTo detect Popup created (QQC2):

    Out of curiosity, have you tried how the Back key behaves with popups in Qt 5.8? I recall that we did some work in that area, to make it work similarly than the Esc key works on desktop. Also the QML Shortcut type should now respect modal popups.

    Do you mean using DialogButtonBox in Popups / Dialogs and Android BACK Key should select Reject, No or DestructiveRole ?
    thx for info

    will refactor all my custom Popups from 5.7 using DialogButtonBox



  • The esc and back keys were previously handled as normal key events, meaning that a popup had to have focus in order for the "close on escape" functionality to work. Now they are handled as shortcuts to make them work reliably regardless of focus. When a dialog is close via this mechanism, it gets rejected, yes. I hope this sounds understandable. :)


  • Qt Champions 2016

    @jpnurmi said in ApplicationWindow.overlay HowTo detect Popup created (QQC2):

    The esc and back keys were previously handled as normal key events, meaning that a popup had to have focus in order for the "close on escape" functionality to work. Now they are handled as shortcuts to make them work reliably regardless of focus. When a dialog is close via this mechanism, it gets rejected, yes. I hope this sounds understandable. :)

    yep :)
    the 'close-on-escape' was the missing part


  • Qt Champions 2016

    @jpnurmi Hi J-P,
    so much work this time with 5.8 update
    finally found the time to test new Popup policies

    Popup without any policy set, then hit Android BACK key
    App does quit() and closes :(

    Setting the policy to Popup.CloseOnPressOutside my Keys.onBackPressed: {} gets the event and I can handle this one
    Keys.onBackPressed: {} is in my root StackView
    Even adding Keys.onBackPressed inside Popup doesn't help

    Keys.onBackPressed: {
            console.log("BACK FROM INSIDE POPUP")
            event.accepted = true
        }
    

    never getting the event - app quits

    So this new default closePolicy is a problem for me , because customers have the feeling the APP is crashing - in reality the APP simply does a quit()
    Have to change all Popups without explicit policy in all of my projects


  • Qt Champions 2016


  • Qt Champions 2016

    @ekkescorner updated my blogpost https://appbus.wordpress.com/2017/03/04/mostly-harmless-update-qt-5-7-0-qt-5-8-0/

    added info about the problems with Popups and Android BACK key together with workarounds


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.