diff options
Diffstat (limited to 'src/quickdialogs2/quickdialogs2/qquickabstractdialog.cpp')
-rw-r--r-- | src/quickdialogs2/quickdialogs2/qquickabstractdialog.cpp | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/quickdialogs2/quickdialogs2/qquickabstractdialog.cpp b/src/quickdialogs2/quickdialogs2/qquickabstractdialog.cpp index 12445c83b7..92d1b37469 100644 --- a/src/quickdialogs2/quickdialogs2/qquickabstractdialog.cpp +++ b/src/quickdialogs2/quickdialogs2/qquickabstractdialog.cpp @@ -125,8 +125,6 @@ Q_LOGGING_CATEGORY(lcDialogs, "qt.quick.dialogs") This signal is emitted when the dialog has been accepted either interactively or by calling \l accept(). - \note This signal is \e not emitted when closing the dialog with \l close(). - \sa rejected() */ @@ -136,7 +134,7 @@ Q_LOGGING_CATEGORY(lcDialogs, "qt.quick.dialogs") This signal is emitted when the dialog has been rejected either interactively or by calling \l reject(). - \note This signal is \e not emitted when closing the dialog with \l close(). + This signal is also emitted when closing the dialog with \l close(). \sa accepted() */ @@ -326,14 +324,17 @@ void QQuickAbstractDialog::open() onShow(m_handle.get()); m_visible = m_handle->show(m_flags, m_modality, m_parentWindow); - if (m_visible) + if (m_visible) { + m_result = Rejected; // in case an accepted dialog gets re-opened, then closed emit visibleChanged(); + } } /*! \qmlmethod void QtQuick.Dialogs::Dialog::close() - Closes the dialog. + Closes the dialog and emits either the \l accepted() or \l rejected() + signal. \sa visible, open() */ @@ -346,6 +347,11 @@ void QQuickAbstractDialog::close() m_handle->hide(); m_visible = false; emit visibleChanged(); + + if (m_result == Accepted) + emit accepted(); + else // if (m_result == Rejected) + emit rejected(); } /*! @@ -381,13 +387,8 @@ void QQuickAbstractDialog::reject() */ void QQuickAbstractDialog::done(StandardCode result) { - close(); setResult(result); - - if (result == Accepted) - emit accepted(); - else if (result == Rejected) - emit rejected(); + close(); } void QQuickAbstractDialog::classBegin() @@ -469,11 +470,22 @@ bool QQuickAbstractDialog::useNativeDialog() const return true; } +/*! + \internal + + Called at the end of \l create(). +*/ void QQuickAbstractDialog::onCreate(QPlatformDialogHelper *dialog) { Q_UNUSED(dialog); } +/*! + \internal + + Called by \l open(), after the call to \l create() and before + the handle/helper's \c show function is called. +*/ void QQuickAbstractDialog::onShow(QPlatformDialogHelper *dialog) { Q_UNUSED(dialog); |