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

REGRESSION: commit a9cbddf4739f3cfabd38367b5f872fe2c1a3814c breaks ability to call processEvents before calling QDialog::exec()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.3.0 RC1
    • Fix Version/s: 5.3.1
    • Component/s: Core: Plugins
    • Labels:
      None
    • Environment:
      Macintosh only, I am running OS X 10.9.2; I don't know if it affects earlier OS versions.
      Qt 5.3 release branch checked out May 2, qtbase 2bf414259021472b8726dda613ddf3263c4fff52
    • Commits:
      626e0f204e846040e8e3a67bfc088f09b5091e7c

      Description

      If you make a modal QDialog, call dialog.show(), then you want to do other stuff for a while. "Other stuff" includes calling processEvents(), in my case so that painting will occur. Calling processEvents() triggers the QEvent::User event that was posted for the modal session, and starts the modal behavior instead of waiting for QDialog::exec().

      Lines 744-754 in qcocoaeventdispatcher.mm define a new event() override that gets run by my call to processEvents(). It calls processEvents() to start the modal behavior.

      My use case seems to be allowed by this bit from the QDialog docs in the section on Modal Dialogs:

      "An alternative is to call setModal(true) or setWindowModality(), then show(). Unlike exec(), show() returns control to the caller immediately. Calling setModal(true) is especially useful for progress dialogs, where the user must have the ability to interact with the dialog, e.g. to cancel a long running operation. If you use show() and setModal(true) together to perform a long operation, you must call QApplication::processEvents() periodically during processing to enable the user to interact with the dialog. (See QProgressDialog.)"

      I did not check to see if this change breaks QProgressDialog.

      As a further note, isn't it dangerous to use QEvent::User for this purpose? Won't that potentially break applications that create user events with that ID?

      I have attached a simple application that shows the problem.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              dedietri Gabriel de Dietrich (drgvond)
              Reporter:
              johnweeks John Weeks
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes