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

macOS: QEvent::Quit is always delivered as a spontaneous event

    XMLWordPrintable

Details

    • User Story
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • None
    • Core: Event loop
    • None
    • macOS

    Description

      Events should only have the spontaneous flag set if they original from outside the application itself. Synthesised events should not have the flag set, so that applications can distinguish between them (and so that a test framework can replay only spontaneous events).

      QEvent::Quit might be generated when QApplication::quit() is called by the application (e.g. in response to activating the File->Quit action or the last window getting closed by the user). On macOS, a user can also explicitly quit the application through the tray icon's context menu.

      In the former cases, the Quit event is synthesised in response to the application handling the event; here, the spontaneous flag should not be set. In the latter case, the Quit event is spontaneous.

      Note that this is only a problem with QGuiApplication and QApplication, as their private classes override QCoreApplication::quit() to go through the platform integration (which then by default pretends that the window system requested the application to quit; the Cocoa implementation goes through AppKit's NSApp::terminate). QCoreApplication::quit() just synthesises and posts/sends a QEvent::Quit to itself.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            vhilshei Volker Hilsheimer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes