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>bb10
parent
fda57bbb32
commit
2bafd997ee
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue