Details
-
User Story
-
Resolution: Unresolved
-
P5: Not important
-
None
-
None
-
None
Description
Introduced in February 2005 by Matthias, in 2ae6cadc9e43f9d7643936cff86af9c37cc4cbcc.
The original documentation for the lastWindowClosed signal specified:
For convenience, this signal is \e not emitted for transient top
level widgets such as splash screens, popup menus, and dialogs with
a parent.
And with Matthias' change, was updated to:
Only top level windows with the Qt::WA_QuitOnClose attribute set are
taken into account. For convenience, this attribute is not set for
transient top level widgets such as splash screens, popup menus, and
dialogs.
So the intent was to allow the user to control what was considered a window allowed to trigger and be counted against "last window", which in turn also affected the quit behavior, hence the "QuitOnClose" name, which in hindsight was sadly a misnomer.
This was followed up by 03543fe0156a3fdaab465a84c42a508f2fb2ef64:
Fixes: QuitOnClose behaviour and documentation
Details: There were issues with dialogs, where the current approach was
incompatible with Qt 3, discussions on the qt-interest list, and things Jasmin
ran into for demos. The change is to set QuitOnClose for dialogs as well, but
to ignore any kind of window which isn't a primary window (i.e. has a parent window).
The documentation is now as follows:"The \l QApplication::lastWindowClosed() signal is emitted when the last
visible primary window (i.e. window with no parent) with the
Qt::WA_QuitOnClose attribute set is closed. By default this attribute
is set for all widgets except transient windows such as splash screens,
tool windows, and popup menus."The rationale behind the change is to have a default that satisfies
most common use, ideally only a tiny fraction of our users should have
to learn about the QuitOnClose flag at all.
And later on:
commit 543e3ff2ae42a3cc368859d8bc770dd1f9d90031
Fixes: QSystemTrayIcon prevents lastWindowClosed from being emitted
Details: Just turn off Qt::WA_QuitOnClose. The system tray widget still
appears in QApplication::topLevelWidgets() but we will deal with
that later.
So WA_QuitOnClose was used in various places to prevent lastWindowClosed, rather than the actual quit effect.