summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-02-07 14:04:37 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-15 10:43:20 +0100
commit760a771fce3758fe34b1f3ce8a22f283bb24b326 (patch)
treefacfdedcfe17c21c8ae2de061ea79f6ff60f3fe1 /src/widgets/dialogs
parentf8dbed12266c42785c1e4758eed05833ec035f33 (diff)
Consolidate StandardButton, ButtonRole and related static 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: If400d215338d7cb6dade39d9de60e50b5e7515ef Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp12
-rw-r--r--src/widgets/dialogs/qmessagebox.h7
2 files changed, 10 insertions, 9 deletions
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 1b64b0ba67..3080d5f1e8 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -209,7 +209,7 @@ public:
void init(const QString &title = QString(), const QString &text = QString());
void setupLayout();
void _q_buttonClicked(QAbstractButton *);
- void _q_clicked(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role);
+ void _q_clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role);
QAbstractButton *findButton(int button0, int button1, int button2, int flags);
void addOldButtons(int button0, int button1, int button2);
@@ -524,7 +524,7 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
}
}
-void QMessageBoxPrivate::_q_clicked(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role)
+void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role)
{
Q_UNUSED(role);
Q_Q(QMessageBox);
@@ -2697,8 +2697,8 @@ QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb
void QMessageBoxPrivate::initHelper(QPlatformDialogHelper *h)
{
Q_Q(QMessageBox);
- QObject::connect(h, SIGNAL(clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)),
- q, SLOT(_q_clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)));
+ QObject::connect(h, SIGNAL(clicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole)),
+ q, SLOT(_q_clicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole)));
static_cast<QPlatformMessageDialogHelper *>(h)->setOptions(options);
}
@@ -2719,9 +2719,9 @@ static QMessageDialogOptions::Icon helperIcon(QMessageBox::Icon i)
return QMessageDialogOptions::NoIcon;
}
-static QMessageDialogOptions::StandardButtons helperStandardButtons(QMessageBox * q)
+static QPlatformDialogHelper::StandardButtons helperStandardButtons(QMessageBox * q)
{
- QMessageDialogOptions::StandardButtons buttons(int(q->standardButtons()));
+ QPlatformDialogHelper::StandardButtons buttons(int(q->standardButtons()));
return buttons;
}
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index c5598a8f1d..5fae174fe1 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -72,6 +72,7 @@ class Q_WIDGETS_EXPORT QMessageBox : public QDialog
public:
enum Icon {
+ // keep this in sync with QMessageDialogOptions::Icon
NoIcon = 0,
Information = 1,
Warning = 2,
@@ -80,7 +81,7 @@ public:
};
enum ButtonRole {
- // keep this in sync with QDialogButtonBox::ButtonRole
+ // keep this in sync with QDialogButtonBox::ButtonRole and QPlatformDialogHelper::ButtonRole
InvalidRole = -1,
AcceptRole,
RejectRole,
@@ -96,7 +97,7 @@ public:
};
enum StandardButton {
- // keep this in sync with QDialogButtonBox::StandardButton and QMessageDialogOptions::StandardButton
+ // keep this in sync with QDialogButtonBox::StandardButton and QPlatformDialogHelper::StandardButton
NoButton = 0x00000000,
Ok = 0x00000400,
Save = 0x00000800,
@@ -309,7 +310,7 @@ protected:
private:
Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton *))
- Q_PRIVATE_SLOT(d_func(), void _q_clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole))
+ Q_PRIVATE_SLOT(d_func(), void _q_clicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole))
Q_DISABLE_COPY(QMessageBox)
Q_DECLARE_PRIVATE(QMessageBox)