Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-82194

macOS: MainWindow does not obtain focus when right clicking window

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.13.0, 5.14.0, 5.14.1
    • Widgets: Main Window
    • None
    • macOS

    Description

      When a MainWindow application that is out of focus is right click selected such that a context menu is created, then it is impossible to focus the MainWindow application (qApp->focusWindow() and qApp->focusWidget() are both nullptr). You can regain focus by focusing out of the MainWindow and left click the MainWindow. You can also left click the title bar of the MainWindow.

      This was originally reported and diagnosed on the KeePassXC application on macOS 10.14 and 10.15. The original report is available here: https://github.com/keepassxreboot/keepassxc/issues/3412

      Steps to reproduce:

      1. Have focus on a widget prior to switching to another application
      2. Right click select a different widget in the original application, the MainWindow will NOT receive focus.
      3. Attempt to focus the MainWindow (except clicking the title bar) while the context menu is still open, the app gets into a state where focus cannot be gained.
      4. This is immediately fixed if you focus another application then focus the original app again by left click anywhere OR left click the title bar when the context menu is open.

      Start of broken state:

       

      App in foreground but doesn't have focus:

       

      Normally focused app:

      Attachments

        1. foreground-nofocus.png
          foreground-nofocus.png
          221 kB
        2. normal-focus.png
          normal-focus.png
          244 kB
        3. start-broken.png
          start-broken.png
          369 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            droidmonkey Jonathan White
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes