ActionGroup QML Type▲
-
Import Statement: import QtQuick.Controls
-
Inherits: QtObject
-
Group: ActionGroup is part of utilities
Detailed Description▲
ActionGroup is a non-visual group of actions. A mutually exclusive action group is used with actions where only one of the options can be selected at a time.
The most straight-forward way to use ActionGroup is to declare actions as children of the group.
ActionGroup {
id
:
alignmentGroup
Action {
checked
:
true
checkable
:
true
text
:
qsTr("Left"
)
}
Action {
checkable
:
true
text
:
qsTr("Center"
)
}
Action {
checkable
:
true
text
:
qsTr("Right"
)
}
}
Alternatively, the group attached property allows declaring the actions elsewhere and assigning them to a specific group.
ActionGroup {
id: alignmentGroup }
Action {
checked
:
true
checkable
:
true
text
:
qsTr("Left"
)
ActionGroup.group: alignmentGroup
}
Action {
checkable
:
true
text
:
qsTr("Center"
)
ActionGroup.group: alignmentGroup
}
Action {
checkable
:
true
text
:
qsTr("Right"
)
ActionGroup.group: alignmentGroup
}
More advanced use cases can be handled using the addAction() and removeAction() methods.
See Also▲
See also Action, ButtonGroup
Property Documentation▲
[default] actions : list<Action>▲
checkedAction : Action▲
This property holds the currently selected action in an exclusive group, or null if there is none or the group is non-exclusive.
By default, it is the first checked action added to an exclusive action group.
See Also▲
See also exclusive
enabled : bool▲
This property holds whether the action group is enabled. The default value is true.
If this property is false, then all actions in the group are disabled. If this property is true, all actions in the group are enabled, unless explicitly disabled.
exclusive : bool▲
This property holds whether the action group is exclusive. The default value is true.
If this property is true, then only one action in the group can be checked at any given time. The user can trigger any action to check it, and that action will replace the existing one as the checked action in the group.
In an exclusive group, the user cannot uncheck the currently checked action by triggering it; instead, another action in the group must be triggered to set the new checked action for that group.
In a non-exclusive group, checking and unchecking actions does not affect the other actions in the group. Furthermore, the value of the checkedAction property is null.
Attached Property Documentation▲
ActionGroup.group : ActionGroup▲
Signal Documentation▲
triggered(Action action)▲
This signal is emitted when an action in the group has been triggered.
This signal is convenient for implementing a common signal handler for all actions in the same group.
ActionGroup {
onTriggered
:
console.log("triggered:"
, action.text)
Action {
text: "First"
}
Action {
text: "Second"
}
Action {
text: "Third"
}
}
The corresponding handler is onTriggered.
See Also▲
See also Action::triggered()