summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/dialogs/qdialog.cpp')
-rw-r--r--src/widgets/dialogs/qdialog.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 8b60e8952a..8b018969c8 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -153,7 +153,7 @@ void QDialogPrivate::close(int resultCode)
Q_Q(QDialog);
q->setResult(resultCode);
- q->hide();
+
if (!data.is_closing) {
// Until Qt 6.3 we didn't close dialogs, so they didn't receive a QCloseEvent.
// It is likely that subclasses implement closeEvent and handle them as rejection
@@ -171,6 +171,12 @@ void QDialogPrivate::close(int resultCode)
} closeEventEater;
q->installEventFilter(&closeEventEater);
QWidgetPrivate::close();
+ } else {
+ // If the close was initiated outside of QDialog we will end up
+ // here via QDialog::closeEvent calling reject(), in which case
+ // we need to hide the dialog to ensure QDialog::closeEvent does
+ // not ignore the close event. FIXME: Why is QDialog doing this?
+ q->hide();
}
resetModalitySetByOpen();