In some situations it is useful to group actions together. For example, if you have a left justify action, a right justify action and a center action, only one of these actions should be active at any one time, and one simple way of achieving this is to group the actions together in an action group.
.PP
An action group can also be added to a menu or a toolbar as a single unit, with all the actions within the action group appearing as separate menu options and toolbar buttons.
Here we create a new action group. Since the action group is exclusive by default, only one of the actions in the group is ever active at any one time. We then connect the group's selected() signal to our textAlign() slot.
We create a left align action, add it to the toolbar and the menu and make it a toggle action. We create center and right align actions in exactly the same way.
.PP
The actions in an action group emit their activated() (and for toggle actions, toggled()) signals as usual.
.PP
The setExclusive() function is used to ensure that only one action is active at any one time: it should be used with actions which have their toggleAction set to TRUE.
.PP
Action group actions appear as individual menu options and toolbar buttons. For exclusive action groups use setUsesDropDown() to display the actions in a subwidget of any widget the action group is added to. For example, the actions would appear in a combobox in a toolbar or as a submenu in a menu.
.PP
Actions can be added to an action group using add(), but normally they are added by creating the action with the action group as parent. Actions can have separators dividing them using addSeparator(). Action groups are added to widgets with addTo().
.PP
See also Main Window and Related Classes and Basic Widgets.
If isExclusive() is FALSE or usesDropDown() is FALSE, the actions within the group are added to the widget individually. For example, if the widget is a menu, the actions will appear as individual menu options, and if the widget is a toolbar, the actions will appear as toolbar buttons.
.PP
If both isExclusive() and usesDropDown() are TRUE, the actions are presented either in a combobox (if \fIw\fR is a toolbar) or in a submenu (if \fIw\fR is a menu).
.PP
All actions should be added to the action group \fIbefore\fR the action group is added to the widget. If actions are added to the action group \fIafter\fR the action group has been added to the widget these later actions will \fInot\fR appear.
.PP
See also exclusive, usesDropDown, and removeFrom().
Sets whether the group's actions are displayed in a subwidget of the widgets the action group is added to to \fIenable\fR. See the "usesDropDown" property for details.
Returns TRUE if the group's actions are displayed in a subwidget of the widgets the action group is added to; otherwise returns FALSE. See the "usesDropDown" property for details.
.SS "Property Documentation"
.SH "bool exclusive"
This property holds whether the action group does exclusive toggling.
.PP
If exclusive is TRUE only one toggle action in the action group can ever be active at any one time. If the user chooses another toggle action in the group the one they chose becomes active and the one that was active becomes inactive.
Exclusive action groups added to a toolbar display their actions in a combobox with the action's TQAction::text and TQAction::iconSet properties shown. Non-exclusive groups are represented by a tool button showing their TQAction::iconSet and -- depending on TQMainWindow::usesTextLabel() -- text() property.
Note that setting this property for actions in a combobox causes calls to their TQAction::setVisible(), TQAction::setEnabled(), and TQAction::setDisabled() functions to have no effect.