Fix ignoring closeEvents on OSX for QtQuick.

The QCloseEvent's accepted state should not be inverted for the
QWindowSystemInterfacePrivate::CloseEvent. To make Widgets work
with this change, pass whether the close was accepted from close_helper
to the QCloseEvent generated by QGuiApplication.

Task-number: QTBUG-28965

Change-Id: If384b0355776b93df02dff2ab78b5647903200e7
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Josh Faust <jfaust@suitabletech.com>
bb10
Daiwei Li 2013-08-01 17:24:47 -07:00 committed by The Qt Project
parent 672fcbe9c6
commit bbf19fb295
2 changed files with 4 additions and 3 deletions

View File

@ -1778,7 +1778,7 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
QCloseEvent event;
QGuiApplication::sendSpontaneousEvent(e->window.data(), &event);
if (e->accepted) {
*(e->accepted) = !event.isAccepted();
*(e->accepted) = event.isAccepted();
}
}

View File

@ -538,9 +538,10 @@ void QWidgetWindow::handleResizeEvent(QResizeEvent *event)
}
}
void QWidgetWindow::handleCloseEvent(QCloseEvent *)
void QWidgetWindow::handleCloseEvent(QCloseEvent *event)
{
m_widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
bool is_closing = m_widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
event->setAccepted(is_closing);
}
#ifndef QT_NO_WHEELEVENT