PySide6.QtGui.QActionGroup¶
- class QActionGroup¶
The
QActionGroup
class groups actions together. More…Synopsis¶
Properties¶
enabledᅟ
- Whether the action group is enabledexclusionPolicyᅟ
- This property holds the group exclusive checking policyvisibleᅟ
- Whether the action group is visible
Methods¶
def
__init__()
def
actions()
def
addAction()
def
checkedAction()
def
isEnabled()
def
isExclusive()
def
isVisible()
def
removeAction()
Slots¶
def
setDisabled()
def
setEnabled()
def
setExclusive()
def
setVisible()
Signals¶
def
hovered()
def
triggered()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
QActionGroup
is a base class for classes grouping classes inhheritingQAction
objects together.In some situations it is useful to group
QAction
objects together. For example, if you have a Left Align action, a Right Align action, a Justify action, and a 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, inheritingQActionGroup
.See also
- class ExclusionPolicy¶
This enum specifies the different policies that can be used to control how the group performs exclusive checking on checkable actions.
Constant
Description
QActionGroup.ExclusionPolicy.None
The actions in the group can be checked independently of each other.
QActionGroup.ExclusionPolicy.Exclusive
Exactly one action can be checked at any one time. This is the default policy.
QActionGroup.ExclusionPolicy.ExclusiveOptional
At most one action can be checked at any one time. The actions can also be all unchecked.
See also
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property enabledᅟ: bool¶
This property holds whether the action group is enabled.
Each action in the group will be enabled or disabled unless it has been explicitly disabled.
See also
- Access functions:
- property exclusionPolicyᅟ: QActionGroup.ExclusionPolicy¶
This property holds 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.
See also
checkable
- Access functions:
- property visibleᅟ: bool¶
This property holds 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.
See also
- Access functions:
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 insteadsetExclusionPolicy
(ExclusiveOptional
)Returns the list of this groups’s actions. This may be empty.
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.
See also
- addAction(text)
- Parameters:
text – str
- Return type:
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.
See also
Creates and returns an action with
text
and anicon
. 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.
See also
Returns the currently checked action in the group, or
None
if none are checked.- exclusionPolicy()¶
- Return type:
See also
Getter of property
exclusionPolicyᅟ
.This signal is emitted when the given
action
in the action group is highlighted by the user; for example, when the user pauses with the cursor over a menu option or a toolbar button, or presses an action’s shortcut key combination.See also
- isEnabled()¶
- Return type:
bool
Getter of property
enabledᅟ
.- isExclusive()¶
- Return type:
bool
Returns true if the group is exclusive
The group is exclusive if the
ExclusionPolicy
is either Exclusive or ExclusionOptional.- isVisible()¶
- Return type:
bool
Getter of property
visibleᅟ
.Removes the
action
from this group. The action will have no parent as a result.See also
- setDisabled(b)¶
- Parameters:
b – bool
This is a convenience function for the
enabled
property, that is useful for signals–slots connections. Ifb
is true the action group is disabled; otherwise it is enabled.- setEnabled(arg__1)¶
- Parameters:
arg__1 – bool
See also
Setter of property
enabledᅟ
.- setExclusionPolicy(policy)¶
- Parameters:
policy –
ExclusionPolicy
See also
Setter of property
exclusionPolicyᅟ
.- setExclusive(b)¶
- Parameters:
b – bool
Enable or disable the group exclusion checking
This is a convenience method that calls
setExclusionPolicy
(Exclusive
) whenb
is true, elsesetExclusionPolicy
(None
).See also
- setVisible(arg__1)¶
- Parameters:
arg__1 – bool
See also
Setter of property
visibleᅟ
.This signal is emitted when the given
action
in the action group is activated by the user; for example, when the user clicks a menu option or a toolbar button, or presses an action’s shortcut key combination.Connect to this signal for command actions.
See also