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

QProgressDialog in Qt5 on Mac makes parent window lose focus...sort of(!)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.0.2
    • GUI: Window management
    • None
    • Qt 5.0.2, Mac OS 10.8.4, MacBook Pro 15" retina mid-2013.
      Behavior is experienced when running app from within Qt Creator 2.7.1, and when run from the Terminal (open activewindow.app), and when launched from Finder (double-click .app icon).
    • macOS

    Description

      A minimal example project demonstrating the bug is attached as a .zip file. Here is what it does:

      1. main() creates an instance of MainWindow(), and calls show() and then setup() in it.
      2. setup() creates a child widget of class QProgressDialog (on the stack), and simulates a two-second loading procedure, while the dialog goes from 0% to 100%. At the end of setup(), the dialog is automatically destroyed and hidden.
      3. If you add code that waits one second (so the progress dialog is gone) and then uses qDebug() to dump the values of isActiveWindow() and ui->textEdit->hasFocus(), both report true. Furthermore, the cursor in the QTextEdit is blinking!

      Bug: And yet, the user cannot type text in the QTextEdit; attempting to do so just produces the "bnng" error sound. Furthermore, the window indicates it doesn't really have focus, because the red "close" button is not lit, as in the second attachment. One must click the window (or Cmd-Tab away and back) to get it to really have focus, and light up the red "close" button, as in the third attachment.

      Expected behavior: When the progress dialog goes away, and the cursor starts blinking, that should indicate that the main window really has focus, especially since various Qt functions say it does, and the window is active. The user should be able to type in the widget.

      Attachments

        1. activewindow.zip
          2 kB
        2. ScreenShot1.png
          ScreenShot1.png
          81 kB
        3. ScreenShot2.png
          ScreenShot2.png
          82 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            nathan Nathan Carter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes