
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQ3ActionGroup class groups actions together.More...
| Header: | #include <Q3ActionGroup> |
| Inherits: | Q3Action |
| Q3ActionGroup(QObject * parent, const char * name = 0) | |
| Q3ActionGroup(QObject * parent, const char * name, bool exclusive) | |
| ~Q3ActionGroup() | |
| void | add(Q3Action * action) |
| void | addSeparator() |
| void | insert(Q3Action * action) |
| bool | isExclusive() const |
| void | setExclusive(bool) |
| void | setUsesDropDown(bool enable) |
| bool | usesDropDown() const |
| virtual bool | addTo(QWidget * w) |
| virtual bool | removeFrom(QWidget * w) |
| virtual void | setEnabled(bool enable) |
| virtual void | setIconSet(const QIcon & icon) |
| virtual void | setMenuText(const QString & text) |
| virtual void | setOn(bool on) |
| virtual void | setText(const QString & txt) |
| virtual void | setToggleAction(bool toggle) |
| virtual void | setToolTip(const QString & text) |
| virtual void | setVisible(bool visible) |
| virtual void | setWhatsThis(const QString & text) |
| virtual void | addedTo(QWidget * actionWidget, QWidget * container, Q3Action * a) |
| virtual void | addedTo(int index, Q3PopupMenu * menu, Q3Action * a) |
| virtual void | addedTo(QWidget * actionWidget, QWidget * container) |
| virtual void | addedTo(int index, Q3PopupMenu * menu) |
| virtual void | childEvent(QChildEvent * e) |
TheQ3ActionGroup class groups actions together.
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.
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.
The actions in an action group emit theiractivated() (and for toggle actions,toggled()) signals as usual.
ThesetExclusive() function is used to ensure that only one action is active at any one time: it should be used with actions which have theirtoggleAction set to true.
Action group actions appear as individual menu options and toolbar buttons. For exclusive action groups usesetUsesDropDown() 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.
Actions can be added to an action group usingadd(), but normally they are added by creating the action with the action group as parent. Actions can have separators dividing them usingaddSeparator(). Action groups are added to widgets withaddTo().
This property holds whether the action group does exclusive toggling.
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.
Access functions:
| bool | isExclusive() const |
| void | setExclusive(bool) |
See alsoQ3Action::toggleAction.
This property holds whether the group's actions are displayed in a subwidget of the widgets the action group is added to.
Exclusive action groups added to a toolbar display their actions in a combobox with the action'sQ3Action::text andQ3Action::iconSet properties shown. Non-exclusive groups are represented by a tool button showing theirQ3Action::iconSet andtext() property.
In a popup menu the member actions are displayed in a submenu.
Changing usesDropDown only affectssubsequent calls toaddTo().
This property's default is false.
Access functions:
| bool | usesDropDown() const |
| void | setUsesDropDown(bool enable) |
Constructs an action group calledname, with parentparent.
The action group is exclusive by default. CallsetExclusive(false) to make the action group non-exclusive.
Constructs an action group calledname, with parentparent.
Ifexclusive is true only one toggle action in the group will ever be active.
See alsoexclusive.
Destroys the object and frees allocated resources.
[signal]void Q3ActionGroup::activated(Q3Action * action)This signal is emitted from groups when one of its actions gets activated.
The argument is theaction which was activated.
See alsosetExclusive(),isOn(), andQ3Action::toggled().
Adds actionaction to this 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 alsoaddTo().
Adds a separator to the group.
[virtual]bool Q3ActionGroup::addTo(QWidget * w)Reimplemented fromQ3Action::addTo().
Adds this action group to the widgetw.
IfisExclusive() is false orusesDropDown() 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.
If bothisExclusive() andusesDropDown() are true, the actions are presented either in a combobox (ifw is a toolbar) or in a submenu (ifw is a menu).
All actions should be added to the action groupbefore the action group is added to the widget. If actions are added to the action groupafter the action group has been added to the widget these later actions willnot appear.
See alsosetExclusive(),setUsesDropDown(), andremoveFrom().
[virtual protected]void Q3ActionGroup::addedTo(QWidget * actionWidget,QWidget * container,Q3Action * a)This function is called from theaddTo() function when it has created a widget (actionWidget) for the child actiona in thecontainer.
[virtual protected]void Q3ActionGroup::addedTo(int index,Q3PopupMenu * menu,Q3Action * a)This is an overloaded function.
This function is called from theaddTo() function when it has created a menu item for the child action at the index positionindex in the popup menumenu.
[virtual protected]void Q3ActionGroup::addedTo(QWidget * actionWidget,QWidget * container)Reimplemented fromQ3Action::addedTo().
This is an overloaded function.
This function is called from theaddTo() function when it has created a widget (actionWidget) in thecontainer.
[virtual protected]void Q3ActionGroup::addedTo(int index,Q3PopupMenu * menu)Reimplemented fromQ3Action::addedTo().
This is an overloaded function.
This function is called from theaddTo() function when it has created a menu item at the index positionindex in the popup menumenu.
[virtual protected]void Q3ActionGroup::childEvent(QChildEvent * e)Reimplemented fromQObject::childEvent().
Use add(action) instead.
[virtual]bool Q3ActionGroup::removeFrom(QWidget * w)Reimplemented fromQ3Action::removeFrom().
[signal]void Q3ActionGroup::selected(Q3Action * action)This signal is emitted from exclusive groups when toggle actions change state.
The argument is theaction whose state changed to "on".
See alsosetExclusive(),isOn(), andQ3Action::toggled().
[virtual]void Q3ActionGroup::setEnabled(bool enable)Reimplemented fromQ3Action::setEnabled().
[virtual]void Q3ActionGroup::setIconSet(constQIcon & icon)Reimplemented fromQ3Action::setIconSet().
[virtual]void Q3ActionGroup::setMenuText(constQString & text)Reimplemented fromQ3Action::setMenuText().
[virtual]void Q3ActionGroup::setOn(bool on)Reimplemented fromQ3Action::setOn().
[virtual]void Q3ActionGroup::setText(constQString & txt)Reimplemented fromQ3Action::setText().
[virtual]void Q3ActionGroup::setToggleAction(bool toggle)Reimplemented fromQ3Action::setToggleAction().
[virtual]void Q3ActionGroup::setToolTip(constQString & text)Reimplemented fromQ3Action::setToolTip().
[virtual]void Q3ActionGroup::setVisible(bool visible)Reimplemented fromQ3Action::setVisible().
[virtual]void Q3ActionGroup::setWhatsThis(constQString & text)Reimplemented fromQ3Action::setWhatsThis().
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.