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

Add QCoreApplication::removePostedEvents(qApp, QEvent::Quit); before calling native (non-Qt) widgets

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 4.7.3
    • None

    Description

      When the last widget is closed and quitOnLastWindowClosed is not set to false, QWidget posts a QEvent::Quit to QApplication. If another widget is made visible before the next call to processEvents(), QWidget, automatically removes this event.

      However this is not being done when native widgets (e.g. file dialogs are used). This can lead to some strange behavior (event loops in the thread quit immediately, etc.). I would suggest to add a similar call to remove such posted quit events before opening non-Qt windows from inside Qt. IMO it shouldn't make a difference whether Qt ends up using a native widget or not.

      This of course does not occur when quitOnLastWindowClosed is set to false. Therefore if my suggestion is not implemented, I would like to suggest to add documentation to the appropriate classes, informing developers of this behavior and of the proper solution (setting quitOnLastWindowClosed to false in QApplication).

      This was originally reported by LinusA at http://developer.qt.nokia.com/forums/viewthread/7063/

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            loladiro Keno Fischer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes