Make handling of QEvent::Close consistent with QWindow::close()

The event handler would ignore the close if the window was hidden
while the close() function would not. In addition, the close()
function would force removal of focus etc while the event handler
did not. Make it consistent by calling close() from the event
handler.

Change-Id: Ia05b08299f218620fb40a8cad5d3771158c4701e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
This commit is contained in:
Gunnar Sletta 2014-05-08 11:10:00 +02:00 committed by The Qt Project
parent 32742959a2
commit c99b58a3dc

View File

@ -1945,15 +1945,10 @@ bool QWindow::event(QEvent *ev)
break;
#endif
case QEvent::Close: {
Q_D(QWindow);
bool wasVisible = isVisible();
if (ev->isAccepted()) {
destroy();
if (wasVisible)
d->maybeQuitOnLastWindowClosed();
}
break; }
case QEvent::Close:
if (ev->isAccepted())
close();
break;
case QEvent::Expose:
exposeEvent(static_cast<QExposeEvent *>(ev));