Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [CLOSED] QComboBox doesn't disappear when app loses focus (Mac OS X)
Forum Updated to NodeBB v4.3 + New Features

[CLOSED] QComboBox doesn't disappear when app loses focus (Mac OS X)

Scheduled Pinned Locked Moved General and Desktop
13 Posts 3 Posters 5.3k 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.
  • raven-worxR Offline
    raven-worxR Offline
    raven-worx
    Moderators
    wrote on last edited by
    #2

    did you overwrite the popup view at all?
    Because actually that should be the default behavior.

    Make sure your popup view has the window flag Qt::Popup set.

    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
    If you have a question please use the forum so others can benefit from the solution in the future

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thebeast44
      wrote on last edited by
      #3

      [quote author="raven-worx" date="1390290617"]did you overwrite the popup view at all?
      Because actually that should be the default behavior.

      Make sure your popup view has the window flag Qt::Popup set.[/quote]

      what I meant was, even though it's supposed to stay on top and everything, I want to hide it when I switch to other application.

      I guess the real question here is "how to correctly detect that event of switching to another application"

      1 Reply Last reply
      0
      • raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #4

        yes, thats exactly what the window flag also takes care of.
        Whenever the popup looses focus or the Escape key is pressed it gets closed.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • T Offline
          T Offline
          thebeast44
          wrote on last edited by
          #5

          [quote author="raven-worx" date="1390291352"]yes, thats exactly what the window flag also takes care of.
          Whenever the popup looses focus or the Escape key is pressed it gets closed.[/quote]

          sorry, I'm new to Qt and I'm not quite understanding your advice.

          I've tried setWindowFlags(Qt::Popup) on:
          my main window, which removed title bar and the ability to move window
          the combobox, which made the combobox disappear
          the combobox->view(), which made the contents of combobox disappear.

          could you give me little more detail please?

          1 Reply Last reply
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #6

            i meant you should set in only on the combobox->view().

            But i think i still didn't get you right either.

            Do you want the popup to be open all the time, even if the user switches focus inside your application? And only when your whole application window looses focus you want to hide the combobox popup?

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • T Offline
              T Offline
              thebeast44
              wrote on last edited by
              #7

              [quote author="raven-worx" date="1390292502"]i meant you should set in only on the combobox->view().

              But i think i still didn't get you right either.

              Do you want the popup to be open all the time, even if the user switches focus inside your application? And only when your whole application window looses focus you want to hide the combobox popup?[/quote]

              I don't want to change the default behaviour inside the application (the popup should disappear when I click elsewhere inside the application), but second part is as you say.

              1 Reply Last reply
              0
              • raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by
                #8

                i just checked the default behavior is:
                a Qt::Popup window flag on the combobox popup. This widget is of type QComboBoxPrivateContainer (not part of the public API, so nothing you have to worry about) and has set the popup window flag by default.
                This ensures that the popup gets closed on every focus change outside the popup (including the the application window)

                If this isn't the case it is prevented somewhere in the code you wrote.

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  thebeast44
                  wrote on last edited by
                  #9

                  Ok, thank you for your time.

                  I'm actually looking at somebody else's code, so I'll look into other parts of the program and see if I've missed something from his code.

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    thebeast44
                    wrote on last edited by
                    #10

                    Oh, there's something I forgot to mention.
                    I am developing and testing in Mac OS X environment.
                    (probably the reason for some of the miscommunication)

                    I tested my application in Windows 7.0 environment as an afterthought, and it works fine.
                    But the same code still seems to work differently in Mac OS X.

                    In Windows environment QComboBox popup disappears when the app loses focus (as it should), but in Mac OS X environment QComboBox popup does not disappear and continues to stay on top of everything else.

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      thebeast44
                      wrote on last edited by
                      #11

                      I've changed the title and the content to reflect updated status of my problem.

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        thebeast44
                        wrote on last edited by
                        #12

                        the bug will be fixed in 5.2.1

                        A 1 Reply Last reply
                        0
                        • T thebeast44

                          the bug will be fixed in 5.2.1

                          A Offline
                          A Offline
                          Andrey Shmelew
                          wrote on last edited by
                          #13

                          @thebeast44 said in [CLOSED] QComboBox doesn't disappear when app loses focus (Mac OS X):

                          the bug will be fixed in 5.2.1

                          i have the same issue (linux debian on beaglebone black with touchscreen)

                          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