aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2020-07-27 09:55:37 +0200
committerMitch Curtis <mitch.curtis@qt.io>2020-09-02 17:06:50 +0200
commit0d3b8f832aad04c255dac64588b2693f2119cc0c (patch)
tree14150f63a8c34d9b50fc76a3b9001435b0f39b87 /src
parent0e516bc9638d7b5ade38d356a304473af6adbc48 (diff)
Dialog: emit accepted()/rejected() before closed()
Before this patch, the documentation stated the following for e.g. accept(): "Closes the dialog and emits the accepted() signal." In practice, styles that have enter and/or exit transitions for Dialog result in closed() being emitted after accepted() (and rejected()). As there is no way to guarantee this particular order, we should be consistent and swap it around so that accepted()/rejected() are emitted first. [ChangeLog][Important Behavior Changes] Dialog's accepted() and rejected() signals are now emitted before closed() when calling done(), accept() and reject(). Fixes: QTBUG-85748 Change-Id: I706dda8de28c350d65e3188787af8f66a2c5f07d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickdialog.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/quicktemplates2/qquickdialog.cpp b/src/quicktemplates2/qquickdialog.cpp
index a13b42ee..1fe3545d 100644
--- a/src/quicktemplates2/qquickdialog.cpp
+++ b/src/quicktemplates2/qquickdialog.cpp
@@ -481,7 +481,7 @@ qreal QQuickDialog::implicitFooterHeight() const
/*!
\qmlmethod void QtQuick.Controls::Dialog::accept()
- Closes the dialog and emits the \l accepted() signal.
+ Emits the \l accepted() signal and closes the dialog.
\sa reject(), done()
*/
@@ -493,7 +493,7 @@ void QQuickDialog::accept()
/*!
\qmlmethod void QtQuick.Controls::Dialog::reject()
- Closes the dialog and emits the \l rejected() signal.
+ Emits the \l rejected() signal and closes the dialog.
\sa accept(), done()
*/
@@ -506,21 +506,26 @@ void QQuickDialog::reject()
\since QtQuick.Controls 2.3 (Qt 5.10)
\qmlmethod void QtQuick.Controls::Dialog::done(int result)
- Closes the dialog, sets the \a result, and emits \l accepted() or
- \l rejected() depending on whether the result is \c Dialog.Accepted
- or \c Dialog.Rejected, respectively.
+ \list 1
+ \li Sets the \a result.
+ \li Emits \l accepted() or \l rejected() depending on
+ whether the result is \c Dialog.Accepted or \c Dialog.Rejected,
+ respectively.
+ \li Emits \l closed().
+ \endlist
\sa accept(), reject(), result
*/
void QQuickDialog::done(int result)
{
- close();
setResult(result);
if (result == Accepted)
emit accepted();
else if (result == Rejected)
emit rejected();
+
+ close();
}
#if QT_CONFIG(accessibility)