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

[Mac OS X]QWidgetAction in menu bar deactivates the active window

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.0
    • 5.4.0
    • QPA
    • None
    • I tested on OS X 10.10.1. I think it probably happens on other versions of OS X. The bug does not happen on Windows.
    • macOS
    • b50ee28eb52fa23c05a9599e02e9671f7ab42d10

    Description

      If you have a QWidgetAction in a menu in the menubar on OS X, when that action is displayed (you don't have to select the action, or even roll over it) the currently active window is de-activated. But when the QWidgetAction is hidden, the window is not re-activated, leaving the window in a strange state.

      I have attached a project that illustrates the problem. The application shows two instances of a subclass QMainWindow, each with a QLineEdit and a QPlainTextEdit. The subclass overrides QMainWindow::event() to intercept QEvent::WindowActivated and QEvent::WindowDeactivated events; it logs a line into the appropriate QPlainTextEdit to show the activation/deactivation history of the two windows.

      Run the application. With First Window as the active window, pull down the TEST menu. As you roll down the menu, you will first roll over a normal menu item. Next you will roll over an item that activates a submenu; that submenu contains a QWidgetAction. Note that as the submenu is displayed, First Window logs a Deactivate event.

      Type ESC or click in First Window to dismiss the menu.

      Now the window is in a strange state- the title bar appears active, but neither the QLineEdit nor the QPlainTextEdit have a blinking caret. If you drag over text in either widget, it will select the dragged text, but highlights it in the gray inactive selection color.

      Now click in Second Window. Second Window gets a WindowActivate event, but First Window gets nothing.

      Now click in First Window. First Window gets a WindowActivate event and Second Window gets a WindowDeactivate event. Now First Window acts normally.

      In our real application where I discovered this bug, the same QWidgetAction in a contextual menu does not cause this problem.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            johnweeks John Weeks
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change