File indexing completed on 2025-01-18 10:07:57
0001
0002
0003
0004 #ifndef QACTIONGROUP_H
0005 #define QACTIONGROUP_H
0006
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtGui/qaction.h>
0009
0010 QT_REQUIRE_CONFIG(action);
0011
0012 QT_BEGIN_NAMESPACE
0013
0014 class QActionGroupPrivate;
0015
0016 class Q_GUI_EXPORT QActionGroup : public QObject
0017 {
0018 Q_OBJECT
0019 Q_DECLARE_PRIVATE(QActionGroup)
0020
0021 Q_PROPERTY(QActionGroup::ExclusionPolicy exclusionPolicy READ exclusionPolicy WRITE setExclusionPolicy)
0022 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
0023 Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
0024
0025 public:
0026 enum class ExclusionPolicy {
0027 None,
0028 Exclusive,
0029 ExclusiveOptional
0030 };
0031 Q_ENUM(ExclusionPolicy)
0032
0033 explicit QActionGroup(QObject *parent);
0034 ~QActionGroup();
0035
0036 QAction *addAction(QAction *a);
0037 QAction *addAction(const QString &text);
0038 QAction *addAction(const QIcon &icon, const QString &text);
0039 void removeAction(QAction *a);
0040 QList<QAction*> actions() const;
0041 QAction *checkedAction() const;
0042
0043 bool isExclusive() const;
0044 bool isEnabled() const;
0045 bool isVisible() const;
0046 ExclusionPolicy exclusionPolicy() const;
0047
0048
0049 public Q_SLOTS:
0050 void setEnabled(bool);
0051 inline void setDisabled(bool b) { setEnabled(!b); }
0052 void setVisible(bool);
0053 void setExclusive(bool);
0054 void setExclusionPolicy(ExclusionPolicy policy);
0055
0056 Q_SIGNALS:
0057 void triggered(QAction *);
0058 void hovered(QAction *);
0059
0060 private Q_SLOTS:
0061 void _q_actionTriggered();
0062 void _q_actionHovered();
0063 void _q_actionChanged();
0064
0065 protected:
0066 QActionGroup(QActionGroupPrivate &dd, QObject *parent);
0067
0068 private:
0069 Q_DISABLE_COPY(QActionGroup)
0070 };
0071
0072 QT_END_NAMESPACE
0073
0074 #endif