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
Functions#
def
actions
()def
addAction
(a)def
addAction
(icon, text)def
addAction
(text)def
checkedAction
()def
exclusionPolicy
()def
isEnabled
()def
isExclusive
()def
isVisible
()def
removeAction
(a)
Slots#
def
setDisabled
(b)def
setEnabled
(arg__1)def
setExclusionPolicy
(policy)def
setExclusive
(arg__1)def
setVisible
(arg__1)
Signals#
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 inhheriting QAction
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, inheriting QActionGroup
.
See also
- class PySide6.QtGui.QActionGroup(parent)#
- Parameters:
parent –
PySide6.QtCore.QObject
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
( ExclusiveOptional
)
Note
Properties can be used directly when from __feature__ import true_property
is used or via accessor functions otherwise.
- property PᅟySide6.QtGui.QActionGroup.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:
isEnabled
()setEnabled
(arg__1)
- property PᅟySide6.QtGui.QActionGroup.exclusionPolicy: 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:
setExclusionPolicy
(policy)
- property PᅟySide6.QtGui.QActionGroup.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:
isVisible
()setVisible
(arg__1)
- PySide6.QtGui.QActionGroup.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
- PySide6.QtGui.QActionGroup.actions()#
- Return type:
Returns the list of this groups’s actions. This may be empty.
- PySide6.QtGui.QActionGroup.addAction(a)#
- Parameters:
- Return type:
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
- PySide6.QtGui.QActionGroup.addAction(icon, text)
- Parameters:
icon –
PySide6.QtGui.QIcon
text – str
- Return type:
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.
See also
- PySide6.QtGui.QActionGroup.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
- PySide6.QtGui.QActionGroup.checkedAction()#
- Return type:
Returns the currently checked action in the group, or None
if none are checked.
- PySide6.QtGui.QActionGroup.exclusionPolicy()#
- Return type:
See also
Getter of property exclusionPolicy
.
- PySide6.QtGui.QActionGroup.hovered(arg__1)#
- Parameters:
arg__1 –
PySide6.QtGui.QAction
- PySide6.QtGui.QActionGroup.isEnabled()#
- Return type:
bool
Getter of property enabled
.
- PySide6.QtGui.QActionGroup.isExclusive()#
- Return type:
bool
Returns true if the group is exclusive
The group is exclusive if the ExclusionPolicy
is either Exclusive or ExclusionOptional.
- PySide6.QtGui.QActionGroup.isVisible()#
- Return type:
bool
Getter of property visible
.
- PySide6.QtGui.QActionGroup.removeAction(a)#
- Parameters:
Removes the action
from this group. The action will have no parent as a result.
See also
- PySide6.QtGui.QActionGroup.setDisabled(b)#
- Parameters:
b – bool
This is a convenience function for the enabled
property, that is useful for signals–slots connections. If b
is true the action group is disabled; otherwise it is enabled.
- PySide6.QtGui.QActionGroup.setEnabled(arg__1)#
- Parameters:
arg__1 – bool
See also
Setter of property enabled
.
- PySide6.QtGui.QActionGroup.setExclusionPolicy(policy)#
- Parameters:
policy –
ExclusionPolicy
See also
Setter of property exclusionPolicy
.
- PySide6.QtGui.QActionGroup.setExclusive(arg__1)#
- Parameters:
arg__1 – bool
Enable or disable the group exclusion checking
This is a convenience method that calls setExclusionPolicy
( Exclusive
) when b
is true, else setExclusionPolicy
( None
).
See also
- PySide6.QtGui.QActionGroup.setVisible(arg__1)#
- Parameters:
arg__1 – bool
See also
Setter of property visible
.
- PySide6.QtGui.QActionGroup.triggered(arg__1)#
- Parameters:
arg__1 –
PySide6.QtGui.QAction