I think you should reimplement QDialog::reject.