diff options
Diffstat (limited to 'src/widgets/dialogs/qdialog.cpp')
-rw-r--r-- | src/widgets/dialogs/qdialog.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index f5db4481ee..06f0393b4c 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -100,6 +100,10 @@ static inline int themeDialogType(const QDialog *dialog) if (qobject_cast<const QErrorMessage *>(dialog)) return QPlatformTheme::MessageDialog; #endif +#if !QT_CONFIG(filedialog) && !QT_CONFIG(colordialog) && !QT_CONFIG(fontdialog) && \ + !QT_CONFIG(messagebox) && !QT_CONFIG(errormessage) + Q_UNUSED(dialog); +#endif return -1; } @@ -514,6 +518,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() */ @@ -560,9 +571,12 @@ int QDialog::exec() } /*! - Closes the dialog and sets its result code to \a r. If this dialog - is shown with exec(), done() causes the local event loop to finish, - and exec() to return \a r. + Closes the dialog and sets its result code to \a r. The finished() signal + will emit \a r; if \a r is QDialog::Accepted or QDialog::Rejected, the + accepted() or the rejected() signals will also be emitted, respectively. + + If this dialog is shown with exec(), done() also causes the local event loop + to finish, and exec() to return \a r. As with QWidget::close(), done() deletes the dialog if the Qt::WA_DeleteOnClose flag is set. If the dialog is the application's |