When a dialog was accepted or rejected via done(), we used to only hide
it, but as of 0246bfd40a we now close it.
Closing a widget results in hiding it as part of handleClose, so we
do not need to explicitly hide it before calling close(). In fact
doing so prevents the lastWindowClosed logic from checking whether
the window was visible before handling the close event, which is
documented to be a requirement for a window triggering lastWindowClosed.
We still need to hide the widget in case we don't end up closing it
ourselves, to ensure QDialog::closeEvent accepts the close. The reason
for the code in closeEvent seems a bit dubious, but that's left for
future adventures.
Change-Id: Ic32b965d495c08996c3a199bbee798df0206216c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>