diff options
| author | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-02-14 09:19:38 +0100 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-15 20:54:18 +0100 |
| commit | f212322a6ecb237d5fb53e56c6dafffb87e45f09 (patch) | |
| tree | 8eccda50c4ef429ffb26ed3017b217c34bda72c3 /src | |
| parent | e70ba908b753ea9dcef7c5931382a39b9e8b17d9 (diff) | |
Consolidate StandardButton, ButtonRole and related functions
Moving them into QPlatformDialogHelper for the convenience of both
widgets and QtQuick.Dialogs. The main reason is to ensure that
QtQuick.Dialogs does not need to depend on the widgets module, in
order to re-implement the button box concept in a generic dialog.
Change-Id: I471dff185767d05f3579c76082550008085ee681
Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/dialogs/qquickabstractmessagedialog.cpp | 28 | ||||
| -rw-r--r-- | src/dialogs/qquickabstractmessagedialog_p.h | 40 | ||||
| -rw-r--r-- | src/widgets/qmessageboxhelper_p.h | 4 |
3 files changed, 36 insertions, 36 deletions
diff --git a/src/dialogs/qquickabstractmessagedialog.cpp b/src/dialogs/qquickabstractmessagedialog.cpp index a44464962..2c24c4ba6 100644 --- a/src/dialogs/qquickabstractmessagedialog.cpp +++ b/src/dialogs/qquickabstractmessagedialog.cpp @@ -129,51 +129,51 @@ QUrl QQuickAbstractMessageDialog::standardIconSource() void QQuickAbstractMessageDialog::setStandardButtons(StandardButtons buttons) { if (buttons != m_options->standardButtons()) { - m_options->setStandardButtons(static_cast<QMessageDialogOptions::StandardButtons>(static_cast<int>(buttons))); + m_options->setStandardButtons(static_cast<QPlatformDialogHelper::StandardButtons>(static_cast<int>(buttons))); emit standardButtonsChanged(); } } -void QQuickAbstractMessageDialog::click(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role) +void QQuickAbstractMessageDialog::click(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role) { setVisible(false); m_clickedButton = static_cast<StandardButton>(button); emit buttonClicked(); switch (role) { - case QMessageDialogOptions::AcceptRole: + case QPlatformDialogHelper::AcceptRole: emit accept(); break; - case QMessageDialogOptions::RejectRole: + case QPlatformDialogHelper::RejectRole: emit reject(); break; - case QMessageDialogOptions::DestructiveRole: + case QPlatformDialogHelper::DestructiveRole: emit discard(); break; - case QMessageDialogOptions::HelpRole: + case QPlatformDialogHelper::HelpRole: emit help(); break; - case QMessageDialogOptions::YesRole: + case QPlatformDialogHelper::YesRole: emit yes(); break; - case QMessageDialogOptions::NoRole: + case QPlatformDialogHelper::NoRole: emit no(); break; - case QMessageDialogOptions::ApplyRole: + case QPlatformDialogHelper::ApplyRole: emit apply(); break; - case QMessageDialogOptions::ResetRole: + case QPlatformDialogHelper::ResetRole: emit reset(); break; default: - qWarning("unhandled MessageDialog button %d with role %d", button, role); + qWarning("unhandled MessageDialog button %d with role %d", (int)button, (int)role); } } void QQuickAbstractMessageDialog::click(QQuickAbstractMessageDialog::StandardButton button) { - click(static_cast<QMessageDialogOptions::StandardButton>(button), - static_cast<QMessageDialogOptions::ButtonRole>( - QMessageDialogOptions::buttonRole(static_cast<QMessageDialogOptions::StandardButton>(button)))); + click(static_cast<QPlatformDialogHelper::StandardButton>(button), + static_cast<QPlatformDialogHelper::ButtonRole>( + QPlatformDialogHelper::buttonRole(static_cast<QPlatformDialogHelper::StandardButton>(button)))); } QT_END_NAMESPACE diff --git a/src/dialogs/qquickabstractmessagedialog_p.h b/src/dialogs/qquickabstractmessagedialog_p.h index f2427bb2e..2afea1dc0 100644 --- a/src/dialogs/qquickabstractmessagedialog_p.h +++ b/src/dialogs/qquickabstractmessagedialog_p.h @@ -99,25 +99,25 @@ public: QUrl standardIconSource(); enum StandardButton { - NoButton = QMessageDialogOptions::NoButton, - Ok = QMessageDialogOptions::Ok, - Save = QMessageDialogOptions::Save, - SaveAll = QMessageDialogOptions::SaveAll, - Open = QMessageDialogOptions::Open, - Yes = QMessageDialogOptions::Yes, - YesToAll = QMessageDialogOptions::YesToAll, - No = QMessageDialogOptions::No, - NoToAll = QMessageDialogOptions::NoToAll, - Abort = QMessageDialogOptions::Abort, - Retry = QMessageDialogOptions::Retry, - Ignore = QMessageDialogOptions::Ignore, - Close = QMessageDialogOptions::Close, - Cancel = QMessageDialogOptions::Cancel, - Discard = QMessageDialogOptions::Discard, - Help = QMessageDialogOptions::Help, - Apply = QMessageDialogOptions::Apply, - Reset = QMessageDialogOptions::Reset, - RestoreDefaults = QMessageDialogOptions::RestoreDefaults + NoButton = QPlatformDialogHelper::NoButton, + Ok = QPlatformDialogHelper::Ok, + Save = QPlatformDialogHelper::Save, + SaveAll = QPlatformDialogHelper::SaveAll, + Open = QPlatformDialogHelper::Open, + Yes = QPlatformDialogHelper::Yes, + YesToAll = QPlatformDialogHelper::YesToAll, + No = QPlatformDialogHelper::No, + NoToAll = QPlatformDialogHelper::NoToAll, + Abort = QPlatformDialogHelper::Abort, + Retry = QPlatformDialogHelper::Retry, + Ignore = QPlatformDialogHelper::Ignore, + Close = QPlatformDialogHelper::Close, + Cancel = QPlatformDialogHelper::Cancel, + Discard = QPlatformDialogHelper::Discard, + Help = QPlatformDialogHelper::Help, + Apply = QPlatformDialogHelper::Apply, + Reset = QPlatformDialogHelper::Reset, + RestoreDefaults = QPlatformDialogHelper::RestoreDefaults }; Q_DECLARE_FLAGS(StandardButtons, StandardButton) @@ -133,7 +133,7 @@ public Q_SLOTS: void setDetailedText(const QString &arg); void setIcon(Icon icon); void setStandardButtons(StandardButtons buttons); - void click(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole); + void click(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole); void click(QQuickAbstractMessageDialog::StandardButton button); Q_SIGNALS: diff --git a/src/widgets/qmessageboxhelper_p.h b/src/widgets/qmessageboxhelper_p.h index 4f1070f97..bf3eef32d 100644 --- a/src/widgets/qmessageboxhelper_p.h +++ b/src/widgets/qmessageboxhelper_p.h @@ -97,8 +97,8 @@ public: public Q_SLOTS: void buttonClicked(QAbstractButton* button) { - emit clicked(static_cast<QMessageDialogOptions::StandardButton>(m_dialog.standardButton(button)), - static_cast<QMessageDialogOptions::ButtonRole>(m_dialog.buttonRole(button))); + emit clicked(static_cast<QPlatformDialogHelper::StandardButton>(m_dialog.standardButton(button)), + static_cast<QPlatformDialogHelper::ButtonRole>(m_dialog.buttonRole(button))); } }; |
