Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QDIALOGBUTTONBOX_H
00043 #define QDIALOGBUTTONBOX_H
00044
00045 #include <QtGui/qwidget.h>
00046
00047 QT_BEGIN_HEADER
00048
00049 QT_BEGIN_NAMESPACE
00050
00051 QT_MODULE(Gui)
00052
00053 class QAbstractButton;
00054 class QPushButton;
00055 class QDialogButtonBoxPrivate;
00056
00057 class Q_GUI_EXPORT QDialogButtonBox : public QWidget
00058 {
00059 Q_OBJECT
00060 Q_FLAGS(StandardButtons)
00061 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
00062 Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons)
00063 Q_PROPERTY(bool centerButtons READ centerButtons WRITE setCenterButtons)
00064
00065 public:
00066 enum ButtonRole {
00067
00068 InvalidRole = -1,
00069 AcceptRole,
00070 RejectRole,
00071 DestructiveRole,
00072 ActionRole,
00073 HelpRole,
00074 YesRole,
00075 NoRole,
00076 ResetRole,
00077 ApplyRole,
00078
00079 NRoles
00080 };
00081
00082 enum StandardButton {
00083
00084 NoButton = 0x00000000,
00085 Ok = 0x00000400,
00086 Save = 0x00000800,
00087 SaveAll = 0x00001000,
00088 Open = 0x00002000,
00089 Yes = 0x00004000,
00090 YesToAll = 0x00008000,
00091 No = 0x00010000,
00092 NoToAll = 0x00020000,
00093 Abort = 0x00040000,
00094 Retry = 0x00080000,
00095 Ignore = 0x00100000,
00096 Close = 0x00200000,
00097 Cancel = 0x00400000,
00098 Discard = 0x00800000,
00099 Help = 0x01000000,
00100 Apply = 0x02000000,
00101 Reset = 0x04000000,
00102 RestoreDefaults = 0x08000000,
00103
00104 #ifndef Q_MOC_RUN
00105 FirstButton = Ok,
00106 LastButton = RestoreDefaults
00107 #endif
00108 };
00109
00110 Q_DECLARE_FLAGS(StandardButtons, StandardButton)
00111
00112 enum ButtonLayout {
00113 WinLayout,
00114 MacLayout,
00115 KdeLayout,
00116 GnomeLayout
00117 };
00118
00119 QDialogButtonBox(QWidget *parent = 0);
00120 QDialogButtonBox(Qt::Orientation orientation, QWidget *parent = 0);
00121 QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation = Qt::Horizontal,
00122 QWidget *parent = 0);
00123 ~QDialogButtonBox();
00124
00125 void setOrientation(Qt::Orientation orientation);
00126 Qt::Orientation orientation() const;
00127
00128 void addButton(QAbstractButton *button, ButtonRole role);
00129 QPushButton *addButton(const QString &text, ButtonRole role);
00130 QPushButton *addButton(StandardButton button);
00131 void removeButton(QAbstractButton *button);
00132 void clear();
00133
00134 QList<QAbstractButton *> buttons() const;
00135 ButtonRole buttonRole(QAbstractButton *button) const;
00136
00137 void setStandardButtons(StandardButtons buttons);
00138 StandardButtons standardButtons() const;
00139 StandardButton standardButton(QAbstractButton *button) const;
00140 QPushButton *button(StandardButton which) const;
00141
00142 void setCenterButtons(bool center);
00143 bool centerButtons() const;
00144
00145 Q_SIGNALS:
00146 void clicked(QAbstractButton *button);
00147 void accepted();
00148 void helpRequested();
00149 void rejected();
00150
00151 protected:
00152 void changeEvent(QEvent *event);
00153 bool event(QEvent *event);
00154
00155 private:
00156 Q_DISABLE_COPY(QDialogButtonBox)
00157 Q_DECLARE_PRIVATE(QDialogButtonBox)
00158 Q_PRIVATE_SLOT(d_func(), void _q_handleButtonClicked())
00159 Q_PRIVATE_SLOT(d_func(), void _q_handleButtonDestroyed())
00160 };
00161
00162 Q_DECLARE_OPERATORS_FOR_FLAGS(QDialogButtonBox::StandardButtons)
00163
00164 QT_END_NAMESPACE
00165
00166 QT_END_HEADER
00167
00168 #endif // QDIALOGBUTTONBOX_H