diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2019-03-13 15:45:38 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2019-03-19 19:31:42 +0000 |
commit | 2bafd997ee515d3b6a6a8fb030e1265a4713713e (patch) | |
tree | 813f63175753be00c5760e0d71dfe9fd3ac320f4 /src | |
parent | fda57bbb32c7c08e750f9ed82d30d95052f927b5 (diff) |
Don't quit when last QWindow is destroyed, wait for it to close
Destroying windows happens independently of closing them, e.g. when
a window is moved from one screen to another non-sibling screen.
The logic for quitting the application should apply to the actual
closing of a window, as documented.
Change-Id: I2226aff29278aa6fbf054a0994a320eb53196e9e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index f1e08826a8..453aa1ed83 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1910,9 +1910,6 @@ void QWindowPrivate::destroy() resizeEventPending = true; receivedExpose = false; exposed = false; - - if (wasVisible) - maybeQuitOnLastWindowClosed(); } /*! @@ -2301,8 +2298,17 @@ bool QWindow::event(QEvent *ev) #endif case QEvent::Close: - if (ev->isAccepted()) + if (ev->isAccepted()) { + Q_D(QWindow); + bool wasVisible = isVisible(); destroy(); + if (wasVisible) { + // FIXME: This check for visibility is a workaround for both QWidgetWindow + // and QWindow having logic to emit lastWindowClosed, and possibly quit the + // application. We should find a better way to handle this. + d->maybeQuitOnLastWindowClosed(); + } + } break; case QEvent::Expose: |