Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Solved][Android] [Qt 5.2] Popup dialog doesn't close with touch/click
Forum Updated to NodeBB v4.3 + New Features

[Solved][Android] [Qt 5.2] Popup dialog doesn't close with touch/click

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 2 Posters 5.5k Views 1 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.
  • D Offline
    D Offline
    deleted57
    wrote on 7 Mar 2014, 14:38 last edited by
    #1

    Hi

    In my android tool made with Qt I would like to use some popup dialog. Testing the code under Windows it work very well. The popup show up and if I click in some area of the window outside the popup area the popup close automatically itself as expected. Same behaviour doesn't happen in android (emulator) where the popup stay visible and there is not way to close itself by touching around.

    Someone can help?

    Thank you

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 9 Mar 2014, 05:52 last edited by
      #2

      Hi,

      Which Popup Dialog have you used ?
      Try using "Menu":http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-menu.html if it fits your requirement.
      It works perfectly as per your description on android.

      157

      1 Reply Last reply
      0
      • D Offline
        D Offline
        deleted57
        wrote on 9 Mar 2014, 09:26 last edited by
        #3

        Hi

        Thank you for your reply. I created a QDialog with the popup window flag (I develop from C++ side, not QML). This dialog show as square with shadow and correctly disappear when I click in area outside it. Same behaviour doesn't happen under android. I can know android architecture is different since, I guess, the OS is basically a single window interface but I need to find a way for detect a click/touch outside my dialog. This for detect when close it. Unfortunately grab mouse function is not suppotred in android...

        1 Reply Last reply
        0
        • P Offline
          P Offline
          p3c0
          Moderators
          wrote on 12 Mar 2014, 08:58 last edited by
          #4

          Hi,

          Check if closeEvent() is getting called.
          I tested the same on Qt 5.2.1 and the Dialog with Popup flag opens and closes as expected.

          157

          1 Reply Last reply
          0
          • D Offline
            D Offline
            deleted57
            wrote on 12 Mar 2014, 09:58 last edited by
            #5

            Hi

            Thank you for your help. I'll try to check the event you suggested. Just for know do you start your popup dialog using exec()? I show the popup dialog in modal mode since I need to stop the code until the popup will close but if this is not the right way for have pupop working on android I'll can find a workaround for my code...

            1 Reply Last reply
            0
            • D Offline
              D Offline
              deleted57
              wrote on 12 Mar 2014, 10:12 last edited by
              #6

              Just made the test. The event closeEvent() was not called if I click/touch outside the popup dialog and, in consequence, the popup dialog was not closed.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                deleted57
                wrote on 12 Mar 2014, 11:02 last edited by
                #7

                Very happy to discover the problem came from the use of exec(). I just made the test and using show() instead of exec() the popup dialog show and automatically close as expected. Thank you for your suggestion, it helped me a lot. :)

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  p3c0
                  Moderators
                  wrote on 12 Mar 2014, 11:14 last edited by
                  #8

                  That's great. I had used show() for displaying it :). But exec() should also work similar. Now since you have mentioned that you have to stop the control until the popup dialog closes you can emit signal from the closeEvent of the dialog to the parent and in the corresponding slot in parent you can execute the next code.

                  157

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    deleted57
                    wrote on 12 Mar 2014, 11:29 last edited by
                    #9

                    it seem exec() work under Windows only. I suspect the problem came from the window management of android that is basically a single window mode. On the contrary Windows is a multi windows mode than can manage event outside a modal dialog (I suppose). About simulate the stop I already found a working solution. I put a cicle after the show() looping the call to QCoreApplication::processEvents() until close event is received. Is not very elegant but it work, just tested!

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      p3c0
                      Moderators
                      wrote on 12 Mar 2014, 11:49 last edited by
                      #10

                      I'm not sure if it is due to single window mode. It works perfectly on Linux too.

                      157

                      1 Reply Last reply
                      0

                      1/10

                      7 Mar 2014, 14:38

                      • Login

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