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

Decouple active window from focus window



    • All
    • 87dd49f63 (dev), 8723daf69 (dev), dfb67989d (dev), 2f6fe3a26 (dev), 4ec05ee2a (6.6), 686bb12ba (tqtc/lts-6.5), 9eb06a284 (dev), 75a560515 (dev), cf9b143cb (dev), 565923306 (6.7), 122b4c21a (6.7), 28ac7a4e6 (6.6), 8c3a2f643 (tqtc/lts-6.5)


      Window focus is not the same as window activation.

      A single window (possibly non-Qt) window is the focus window (receives keyboard input e.g., but not limited to), and is typically also active, but other window may also be active:

      • siblings of that window
      • children of that window
      • parents of that window
        • including transient parents
      • other windows, that the OS considers active even if another window has keyboard focus

      Some things we need to clean up:

      • Widgets
        • Replace tests calling QApplicationPrivate::setActiveWindow with requestActivate
        • Replace QApplicationPrivate::active_window with QGuiApp::focus_window
        • Simplify QApplicationPrivate::setActiveWindow if based on focus window
        • Replace calls to QApplicationPrivate::setActiveWindow with update of focus window and let code in QApplicationPrivate::setActiveWindow trigger as a result, not a cause
      • Gui
        • Plumb QWindow::isActive() to QPlatformWindow::isActive()
          • Remove QWidget::isActiveWindow() plumbing for the same
        • Rename QWSI::processActivatedEvent to focusWindowChange
        • Add dedicated QWSI for window activation change only
        • Emit activeChanged along with notifyActiveWindowChange
        • Deprecate Qt::WindowActive in favor of QWindow::isActive()
        • Send/emit activation change before focus changes in QGuiApplicationPrivate::processFocusWindowEvent
          • Logically makes sense, the window is activated first, and as a result, gains focus
          • Matches the order that widgets receive the events in QApplicationPrivate::setActiveWindow
      • Testlib
        • Add qWaitForWindowFocus(), to distinguish it from qWaitForWindowActive


        For Gerrit Dashboard: QTBUG-119287
        # Subject Branch Project Status CR V



            vestbo Tor Arne Vestbø
            vestbo Tor Arne Vestbø
            0 Vote for this issue
            7 Start watching this issue



              Gerrit Reviews

                There are 4 open Gerrit changes