summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformdialoghelper.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-11-07 13:43:02 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-07 18:40:33 +0100
commit8aab8ccc0ffba504078deb7b4371d2f98c834df3 (patch)
treea243f04984102b8d7ec5af777d3d49f37c50ef54 /src/gui/kernel/qplatformdialoghelper.h
parent42670c7c45db8032a15607124d177c8f454d6f5a (diff)
Dialogs: provide the StandardButton->ButtonRole mapping in QPA
As the QPlatformMessageDialogHelper will be implemented repeatedly, it's useful to have this mapping in one place for reuse. Also, since we do not guarantee that either accepted() or rejected() will be emitted for every possible button on a QtQuick MessageDialog, it's useful for the QtQuick.Dialogs module to have access to this mapping to interpret individual button presses and emit the role-specific signals such as yes(), apply(), help(), etc. Change-Id: I7be753080794adabb784df9b95ac04aa1c29151c Reviewed-by: BogDan Vatra <bogdan@kde.org>
Diffstat (limited to 'src/gui/kernel/qplatformdialoghelper.h')
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index ad818c8644..eb461e3ab3 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -361,6 +361,21 @@ public:
Q_DECLARE_FLAGS(StandardButtons, StandardButton)
+ enum ButtonRole {
+ InvalidRole = -1,
+ AcceptRole,
+ RejectRole,
+ DestructiveRole,
+ ActionRole,
+ HelpRole,
+ YesRole,
+ NoRole,
+ ResetRole,
+ ApplyRole,
+
+ NRoles
+ };
+
QMessageDialogOptions();
QMessageDialogOptions(const QMessageDialogOptions &rhs);
QMessageDialogOptions &operator=(const QMessageDialogOptions &rhs);
@@ -386,6 +401,8 @@ public:
void setStandardButtons(StandardButtons buttons);
StandardButtons standardButtons() const;
+ static ButtonRole buttonRole(StandardButton button);
+
private:
QSharedDataPointer<QMessageDialogOptionsPrivate> d;
};
@@ -400,7 +417,8 @@ public:
void setOptions(const QSharedPointer<QMessageDialogOptions> &options);
Q_SIGNALS:
- void clicked(QMessageDialogOptions::StandardButton button);
+ void clicked(QMessageDialogOptions::StandardButton button); // TODO remove before 5.2
+ void clicked(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role);
private:
QSharedPointer<QMessageDialogOptions> m_options;