Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ApplicationWindow.overlay HowTo detect Popup created (QQC2)
Forum Updated to NodeBB v4.3 + New Features

ApplicationWindow.overlay HowTo detect Popup created (QQC2)

Scheduled Pinned Locked Moved Solved QML and Qt Quick
9 Posts 2 Posters 3.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ekkescornerE Offline
    ekkescornerE Offline
    ekkescorner
    Qt Champions 2016
    wrote on last edited by
    #1

    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

    ekke ... Qt Champion 2016 | 2024 ... mobile business apps
    5.15 --> 6.8 https://t1p.de/ekkeChecklist
    QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

    1 Reply Last reply
    0
    • jpnurmiJ Offline
      jpnurmiJ Offline
      jpnurmi
      wrote on last edited by
      #2

      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.

      ekkescornerE 2 Replies Last reply
      0
      • jpnurmiJ jpnurmi

        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.

        ekkescornerE Offline
        ekkescornerE Offline
        ekkescorner
        Qt Champions 2016
        wrote on last edited by
        #3

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

        ekke ... Qt Champion 2016 | 2024 ... mobile business apps
        5.15 --> 6.8 https://t1p.de/ekkeChecklist
        QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

        1 Reply Last reply
        0
        • jpnurmiJ jpnurmi

          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.

          ekkescornerE Offline
          ekkescornerE Offline
          ekkescorner
          Qt Champions 2016
          wrote on last edited by
          #4

          @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

          ekke ... Qt Champion 2016 | 2024 ... mobile business apps
          5.15 --> 6.8 https://t1p.de/ekkeChecklist
          QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

          1 Reply Last reply
          0
          • jpnurmiJ Offline
            jpnurmiJ Offline
            jpnurmi
            wrote on last edited by
            #5

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

            ekkescornerE 2 Replies Last reply
            0
            • jpnurmiJ jpnurmi

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

              ekkescornerE Offline
              ekkescornerE Offline
              ekkescorner
              Qt Champions 2016
              wrote on last edited by
              #6

              @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

              ekke ... Qt Champion 2016 | 2024 ... mobile business apps
              5.15 --> 6.8 https://t1p.de/ekkeChecklist
              QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

              1 Reply Last reply
              0
              • jpnurmiJ jpnurmi

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

                ekkescornerE Offline
                ekkescornerE Offline
                ekkescorner
                Qt Champions 2016
                wrote on last edited by ekkescorner
                #7

                @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

                ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                5.15 --> 6.8 https://t1p.de/ekkeChecklist
                QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                ekkescornerE 1 Reply Last reply
                0
                • ekkescornerE ekkescorner

                  @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

                  ekkescornerE Offline
                  ekkescornerE Offline
                  ekkescorner
                  Qt Champions 2016
                  wrote on last edited by
                  #8

                  @ekkescorner Opened BUG REPORT:
                  https://bugreports.qt.io/browse/QTBUG-59670

                  ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                  5.15 --> 6.8 https://t1p.de/ekkeChecklist
                  QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                  ekkescornerE 1 Reply Last reply
                  0
                  • ekkescornerE ekkescorner

                    @ekkescorner Opened BUG REPORT:
                    https://bugreports.qt.io/browse/QTBUG-59670

                    ekkescornerE Offline
                    ekkescornerE Offline
                    ekkescorner
                    Qt Champions 2016
                    wrote on last edited by
                    #9

                    @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

                    ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                    5.15 --> 6.8 https://t1p.de/ekkeChecklist
                    QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved