summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2018-05-07 14:15:40 +0200
committerhjk <hjk@qt.io>2018-05-15 06:50:44 +0000
commit2be468640470b29655ee22d343553b3868db6056 (patch)
tree0b8ec130638f7ed7419b586929dfe72712fbf9f3 /src/widgets/dialogs
parent4f421c274bb8f7d9bc6fb968f4d8275d1cd3cf06 (diff)
Add a note to QDialog::exec() to prefer open() instead
QDialog::exec() has a number of problems due to spinning an inner event loop (to counteract its being synchronous). We've had QDialog::open() as a better alternative for a long while now, so encourage people to use that instead. Change-Id: I51a69a018dcbf6133adb6c2f69c7caf442008b36 Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qdialog.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index f5db4481ee..ea6cf86e11 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -514,6 +514,13 @@ void QDialog::open()
interaction with the parent window is blocked while the dialog is open.
By default, the dialog is application modal.
+ \note Avoid using this function; instead, use \c{open()}. Unlike exec(),
+ open() is asynchronous, and does not spin an additional event loop. This
+ prevents a series of dangerous bugs from happening (e.g. deleting the
+ dialog's parent while the dialog is open via exec()). When using open() you
+ can connect to the finished() signal of QDialog to be notified when the
+ dialog is closed.
+
\sa open(), show(), result(), setWindowModality()
*/