Because the accept and reject impl look like this(notice the close helper):
{
hide();
setResult(r);
d->close_helper(QWidgetPrivate::CloseNoEvent);
emit finished(r);
if (r == Accepted)
emit accepted();
else if (r == Rejected)
emit rejected();
}
/*!
Hides the modal dialog and sets the result code to \c Accepted.
\sa reject() done()
*/
{
done(Accepted);
}
/*!
Hides the modal dialog and sets the result code to \c Rejected.
\sa accept() done()
*/
{
done(Rejected);
}
void QDialog::done(int r)
{
Q_D(QDialog);
hide();
setResult(r);
d->close_helper(QWidgetPrivate::CloseNoEvent);
emit finished(r);
if (r == Accepted)
emit accepted();
else if (r == Rejected)
emit rejected();
}
/*!
Hides the modal dialog and sets the result code to \c Accepted.
\sa reject() done()
*/
void QDialog::accept()
{
done(Accepted);
}
/*!
Hides the modal dialog and sets the result code to \c Rejected.
\sa accept() done()
*/
void QDialog::reject()
{
done(Rejected);
}
To copy to clipboard, switch view to plain text mode
If you would like the closeEvent to get called then don't use their slots.
Or you could use the finished signal instead the close event.
The close_helper is implemented in QWidget.cpp
Bookmarks