diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-08-14 16:36:57 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-08-14 14:40:49 +0000 |
commit | 8773fdb215709a6680070a462082a42aa3b82585 (patch) | |
tree | 3a29dc22a8fe21abb21890917107e3d52516304d /src/imports/platform/qquickplatformmessagedialog.cpp | |
parent | 781aae2f348190796475bc28003813a9591678ed (diff) |
Platform: add Dialog::done(int) and Dialog::result
A more generic replacement for MessageDialog.clickedButton.
Change-Id: I060f70a48ab258485e3155188e483c4cf24210e0
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/imports/platform/qquickplatformmessagedialog.cpp')
-rw-r--r-- | src/imports/platform/qquickplatformmessagedialog.cpp | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/src/imports/platform/qquickplatformmessagedialog.cpp b/src/imports/platform/qquickplatformmessagedialog.cpp index 68ef3553..b9395eba 100644 --- a/src/imports/platform/qquickplatformmessagedialog.cpp +++ b/src/imports/platform/qquickplatformmessagedialog.cpp @@ -119,7 +119,7 @@ QT_BEGIN_NAMESPACE This signal is emitted when a dialog \a button is clicked. - \sa buttons, clickedButton + \sa buttons */ /*! @@ -233,9 +233,7 @@ QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(qtLabsPlatformDialogs) QQuickPlatformMessageDialog::QQuickPlatformMessageDialog(QObject *parent) - : QQuickPlatformDialog(parent), - m_options(QMessageDialogOptions::create()), - m_clickedButton(QPlatformDialogHelper::NoButton) + : QQuickPlatformDialog(parent), m_options(QMessageDialogOptions::create()) { } @@ -331,7 +329,7 @@ void QQuickPlatformMessageDialog::setDetailedText(const QString &text) \value MessageDialog.Ignore An "Ignore" button defined with the \c AcceptRole. \value MessageDialog.NoButton The dialog has no buttons. - \sa clicked(), clickedButton + \sa clicked() */ QPlatformDialogHelper::StandardButtons QQuickPlatformMessageDialog::buttons() const { @@ -347,18 +345,6 @@ void QQuickPlatformMessageDialog::setButtons(QPlatformDialogHelper::StandardButt emit buttonsChanged(); } -/*! - \qmlproperty enumeration Qt.labs.platform::MessageDialog::clickedButton - - This property holds the button that was clicked. The default value is \c MessageDialog.NoButton. - - \sa buttons -*/ -QPlatformDialogHelper::StandardButton QQuickPlatformMessageDialog::clickedButton() const -{ - return m_clickedButton; -} - QPlatformDialogHelper *QQuickPlatformMessageDialog::createHelper() { QPlatformDialogHelper *dialog = QGuiApplicationPrivate::platformTheme()->createPlatformDialogHelper(QPlatformTheme::MessageDialog); @@ -384,20 +370,8 @@ void QQuickPlatformMessageDialog::applyOptions(QPlatformDialogHelper *handle) void QQuickPlatformMessageDialog::handleClick(QPlatformDialogHelper::StandardButton button) { - bool changed = m_clickedButton != button; - m_clickedButton = button; - - QPlatformDialogHelper::ButtonRole role = QPlatformDialogHelper::buttonRole(button); - if (role == QPlatformDialogHelper::AcceptRole) - accept(); - else if (role == QPlatformDialogHelper::RejectRole) - reject(); - else - close(); - + done(button); emit clicked(button); - if (changed) - emit clickedButtonChanged(); switch (button) { case QPlatformDialogHelper::Ok: emit okClicked(); break; |