Warning, file /include/QtWidgets/qdialogbuttonbox.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QDIALOGBUTTONBOX_H
0005 #define QDIALOGBUTTONBOX_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qwidget.h>
0009
0010 QT_REQUIRE_CONFIG(dialogbuttonbox);
0011
0012 QT_BEGIN_NAMESPACE
0013
0014
0015 class QAbstractButton;
0016 class QPushButton;
0017 class QDialogButtonBoxPrivate;
0018
0019 class Q_WIDGETS_EXPORT QDialogButtonBox : public QWidget
0020 {
0021 Q_OBJECT
0022 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
0023 Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons)
0024 Q_PROPERTY(bool centerButtons READ centerButtons WRITE setCenterButtons)
0025
0026 public:
0027 enum ButtonRole {
0028
0029 InvalidRole = -1,
0030 AcceptRole,
0031 RejectRole,
0032 DestructiveRole,
0033 ActionRole,
0034 HelpRole,
0035 YesRole,
0036 NoRole,
0037 ResetRole,
0038 ApplyRole,
0039
0040 NRoles
0041 };
0042
0043 enum StandardButton {
0044
0045 NoButton = 0x00000000,
0046 Ok = 0x00000400,
0047 Save = 0x00000800,
0048 SaveAll = 0x00001000,
0049 Open = 0x00002000,
0050 Yes = 0x00004000,
0051 YesToAll = 0x00008000,
0052 No = 0x00010000,
0053 NoToAll = 0x00020000,
0054 Abort = 0x00040000,
0055 Retry = 0x00080000,
0056 Ignore = 0x00100000,
0057 Close = 0x00200000,
0058 Cancel = 0x00400000,
0059 Discard = 0x00800000,
0060 Help = 0x01000000,
0061 Apply = 0x02000000,
0062 Reset = 0x04000000,
0063 RestoreDefaults = 0x08000000,
0064
0065 #ifndef Q_MOC_RUN
0066 FirstButton = Ok,
0067 LastButton = RestoreDefaults
0068 #endif
0069 };
0070
0071 Q_DECLARE_FLAGS(StandardButtons, StandardButton)
0072 Q_FLAG(StandardButtons)
0073
0074 enum ButtonLayout {
0075
0076 WinLayout,
0077 MacLayout,
0078 KdeLayout,
0079 GnomeLayout,
0080 AndroidLayout
0081 };
0082
0083 QDialogButtonBox(QWidget *parent = nullptr);
0084 QDialogButtonBox(Qt::Orientation orientation, QWidget *parent = nullptr);
0085 explicit QDialogButtonBox(StandardButtons buttons, QWidget *parent = nullptr);
0086 QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation,
0087 QWidget *parent = nullptr);
0088 ~QDialogButtonBox();
0089
0090 void setOrientation(Qt::Orientation orientation);
0091 Qt::Orientation orientation() const;
0092
0093 void addButton(QAbstractButton *button, ButtonRole role);
0094 QPushButton *addButton(const QString &text, ButtonRole role);
0095 QPushButton *addButton(StandardButton button);
0096 void removeButton(QAbstractButton *button);
0097 void clear();
0098
0099 QList<QAbstractButton *> buttons() const;
0100 ButtonRole buttonRole(QAbstractButton *button) const;
0101
0102 void setStandardButtons(StandardButtons buttons);
0103 StandardButtons standardButtons() const;
0104 StandardButton standardButton(QAbstractButton *button) const;
0105 QPushButton *button(StandardButton which) const;
0106
0107 void setCenterButtons(bool center);
0108 bool centerButtons() const;
0109
0110 Q_SIGNALS:
0111 void clicked(QAbstractButton *button);
0112 void accepted();
0113 void helpRequested();
0114 void rejected();
0115
0116 protected:
0117 void changeEvent(QEvent *event) override;
0118 bool event(QEvent *event) override;
0119
0120 private:
0121 Q_DISABLE_COPY(QDialogButtonBox)
0122 Q_DECLARE_PRIVATE(QDialogButtonBox)
0123 };
0124
0125 Q_DECLARE_OPERATORS_FOR_FLAGS(QDialogButtonBox::StandardButtons)
0126
0127 QT_END_NAMESPACE
0128
0129 #endif