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. Steal the focus from a full screen app in Mac OS X
QtWS25 Last Chance

Steal the focus from a full screen app in Mac OS X

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.5k Views
  • 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.
  • C Offline
    C Offline
    Cesius
    wrote on last edited by
    #1

    Hi!

    I want to open a file dialog on top and it works setting the Qt::WindowStaysOnTopHint flag. The problem is that if there is other application running on full screen my dialog doesn't get the focus.

    How could I do it?

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What version of Qt are you using ? Running on which version of OS X ?

      Can you show a minimal code sample the shows the behavior ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Cesius
        wrote on last edited by
        #3

        Hi SGaist,

        I´m using Qt 5.3 running on OS X 10.9. I can´t show you the code because I´m not at work but I found that calling raise() after show() sets my dialog as the active window.

        The problem is that after closing the dialog, the previous active app doesn´t recover the focus unlike on Windows.

        Could a good approach be getting the PID of the active app before showing the dialog and setting that app as the active one after closing it? I could do it with applescripts. Do you think there´s an easier way?

        Thanks.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Which version of 5.3 ?

          Do you mean your own application doesn't get the focus back ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Cesius
            wrote on last edited by
            #5

            My app needs to collaborate with browsers in order to upload files selected by the user. The workflow is:

            The browser is on top and the user clicks on our website

            The Qt app displays a file dialog on top

            The user select the files he wants to upload

            The browser recovers the focus and the app upload the files on the background

            If the browser is not on full screen mode, it works fine. The problem is that with full screen mode I need to raise the dialog to be displayed on top and after the user select the files it doesn´t get back to the browser.

            On Windows this issue doesn´t exist. Despite being on full screen the dialog is displayed on top but on OS X the behaviour is different.

            I´d need to check it tomorrow but I think the version is 5.3.1

            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