QtBase
v6.3.1
|
The QActionGroup class groups actions together. More...
#include <qactiongroup.h>
Public Types | |
enum class | ExclusionPolicy { None , Exclusive , ExclusiveOptional } |
Public Slots | |
void | setEnabled (bool) |
void | setDisabled (bool b) |
void | setVisible (bool) |
void | setExclusive (bool) |
Enable or disable the group exclusion checking. More... | |
void | setExclusionPolicy (ExclusionPolicy policy) |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals | |
void | triggered (QAction *) |
void | hovered (QAction *) |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Protected Member Functions | |
QActionGroup (QActionGroupPrivate &dd, QObject *parent) | |
Protected Member Functions inherited from QObject | |
QObject * | sender () const |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
Properties | |
QActionGroup::ExclusionPolicy | exclusionPolicy |
This property holds the group exclusive checking policy. More... | |
bool | enabled |
whether the action group is enabled More... | |
bool | visible |
whether the action group is visible More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
The QActionGroup class groups actions together.
\inmodule QtGui
QActionGroup is a base class for classes grouping classes inhheriting QAction objects together.
In some situations it is useful to group QAction objects together. For example, if you have a \uicontrol{Left Align} action, a \uicontrol{Right Align} action, a \uicontrol{Justify} action, and a \uicontrol{Center} action, only one of these actions should be active at any one time. One simple way of achieving this is to group the actions together in an action group, inheriting QActionGroup.
Definition at line 52 of file qactiongroup.h.
|
strong |
This enum specifies the different policies that can be used to control how the group performs exclusive checking on checkable actions.
\value None The actions in the group can be checked independently of each other.
\value Exclusive Exactly one action can be checked at any one time. This is the default policy.
\value ExclusiveOptional At most one action can be checked at any one time. The actions can also be all unchecked.
Enumerator | |
---|---|
None | |
Exclusive | |
ExclusiveOptional |
Definition at line 62 of file qactiongroup.h.
|
explicit |
Constructs an action group for the parent object.
The action group is exclusive by default. Call setExclusive(false) to make the action group non-exclusive. To make the group exclusive but allow unchecking the active action call instead setExclusionPolicy(QActionGroup::ExclusionPolicy::ExclusiveOptional)
Definition at line 137 of file qactiongroup.cpp.
|
default |
Destroys the action group.
|
protected |
Definition at line 142 of file qactiongroup.cpp.
Returns the list of this groups's actions. This may be empty.
Definition at line 236 of file qactiongroup.cpp.
Creates and returns an action with text and an icon. The newly created action is a child of this action group.
Normally an action is added to a group by creating it with the group as its parent, so this function is not usually used.
Definition at line 209 of file qactiongroup.cpp.
Creates and returns an action with text. The newly created action is a child of this action group.
Normally an action is added to a group by creating it with the group as parent, so this function is not usually used.
Definition at line 195 of file qactiongroup.cpp.
Adds the action to this group, and returns it.
Normally an action is added to a group by creating it with the group as its parent, so this function is not usually used.
Definition at line 162 of file qactiongroup.cpp.
QAction * QActionGroup::checkedAction | ( | ) | const |
Returns the currently checked action in the group, or \nullptr if none are checked.
Definition at line 331 of file qactiongroup.cpp.
QActionGroup::ExclusionPolicy QActionGroup::exclusionPolicy | ( | ) | const |
Definition at line 289 of file qactiongroup.cpp.
bool QActionGroup::isEnabled | ( | ) | const |
Definition at line 321 of file qactiongroup.cpp.
bool QActionGroup::isExclusive | ( | ) | const |
Returns true if the group is exclusive.
The group is exclusive if the ExclusionPolicy is either Exclusive or ExclusionOptional.
Definition at line 264 of file qactiongroup.cpp.
bool QActionGroup::isVisible | ( | ) | const |
Definition at line 356 of file qactiongroup.cpp.
Removes the action from this group. The action will have no parent as a result.
Definition at line 220 of file qactiongroup.cpp.
|
inlineslot |
This is a convenience function for the \l enabled property, that is useful for signals–slots connections. If b is true the action group is disabled; otherwise it is enabled.
Definition at line 87 of file qactiongroup.h.
|
slot |
|
slot |
|
slot |
Enable or disable the group exclusion checking.
This is a convenience method that calls setExclusionPolicy(ExclusionPolicy::Exclusive) when b is true, else setExclusionPolicy(QActionGroup::ExclusionPolicy::None).
Definition at line 251 of file qactiongroup.cpp.
|
slot |
Definition at line 346 of file qactiongroup.cpp.
|
readwrite |
whether the action group is enabled
Each action in the group will be enabled or disabled unless it has been explicitly disabled.
Definition at line 108 of file qactiongroup.h.
|
readwrite |
This property holds the group exclusive checking policy.
If exclusionPolicy is set to Exclusive, only one checkable action in the action group can ever be active at any time. If the user chooses another checkable action in the group, the one they chose becomes active and the one that was active becomes inactive. If exclusionPolicy is set to ExclusionOptional the group is exclusive but the active checkable action in the group can be unchecked leaving the group with no actions checked.
Definition at line 108 of file qactiongroup.h.
|
readwrite |
whether the action group is visible
Each action in the action group will match the visible state of this group unless it has been explicitly hidden.
Definition at line 108 of file qactiongroup.h.