The Q3ActionGroup class groups actions together. 更多...
| 头: | #include <Q3ActionGroup> |
| 继承: | 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 ) |
| void | activated (Q3Action * action ) |
| void | selected (Q3Action * action ) |
| 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 ) |
The Q3ActionGroup 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 their activated () (and for toggle actions, toggled ()) signals as usual.
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.
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.
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 ().
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.
访问函数:
| bool | isExclusive () const |
| void | setExclusive (bool) |
另请参阅 Q3Action::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's Q3Action::text and Q3Action::iconSet properties shown. Non-exclusive groups are represented by a tool button showing their Q3Action::iconSet and text () property.
In a popup menu the member actions are displayed in a submenu.
Changing usesDropDown only affects subsequent calls to addTo ().
此特性默认为 false。
访问函数:
| bool | usesDropDown () const |
| void | setUsesDropDown (bool enable ) |
Constructs an action group called name ,采用父级 parent .
The action group is exclusive by default. Call setExclusive (false) to make the action group non-exclusive.
Constructs an action group called name ,采用父级 parent .
若 exclusive is true only one toggle action in the group will ever be active.
另请参阅 exclusive .
销毁对象并释放分配的资源。
[signal]
void
Q3ActionGroup::
activated
(
Q3Action
*
action
)
This signal is emitted from groups when one of its actions gets activated.
The argument is the action which was activated.
另请参阅 setExclusive (), isOn (),和 Q3Action::toggled ().
Adds action action 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.
另请参阅 addTo ().
Adds a separator to the group.
[虚拟]
bool
Q3ActionGroup::
addTo
(
QWidget
*
w
)
重实现自 Q3Action::addTo ().
Adds this action group to the widget w .
若 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.
If both isExclusive () 和 usesDropDown () are true, the actions are presented either in a combobox (if w is a toolbar) or in a submenu (if w is a menu).
All actions should be added to the action group before the action group is added to the widget. If actions are added to the action group after the action group has been added to the widget these later actions will not appear.
另请参阅 setExclusive (), setUsesDropDown (),和 removeFrom ().
[virtual protected]
void
Q3ActionGroup::
addedTo
(
QWidget
*
actionWidget
,
QWidget
*
container
,
Q3Action
*
a
)
此函数被调用从 addTo () function when it has created a widget ( actionWidget ) for the child action a 在 container .
[virtual protected]
void
Q3ActionGroup::
addedTo
(
int
index
,
Q3PopupMenu
*
menu
,
Q3Action
*
a
)
这是重载函数。
此函数被调用从 addTo () function when it has created a menu item for the child action at the index position index in the popup menu menu .
[virtual protected]
void
Q3ActionGroup::
addedTo
(
QWidget
*
actionWidget
,
QWidget
*
container
)
重实现自 Q3Action::addedTo ().
这是重载函数。
此函数被调用从 addTo () function when it has created a widget ( actionWidget ) in the container .
[virtual protected]
void
Q3ActionGroup::
addedTo
(
int
index
,
Q3PopupMenu
*
menu
)
重实现自 Q3Action::addedTo ().
这是重载函数。
此函数被调用从 addTo () function when it has created a menu item at the index position index in the popup menu menu .
[virtual protected]
void
Q3ActionGroup::
childEvent
(
QChildEvent
*
e
)
重实现自 QObject::childEvent ().
Use add( action ) 代替。
[虚拟]
bool
Q3ActionGroup::
removeFrom
(
QWidget
*
w
)
重实现自 Q3Action::removeFrom ().
[signal]
void
Q3ActionGroup::
selected
(
Q3Action
*
action
)
This signal is emitted from exclusive groups when toggle actions change state.
The argument is the action whose state changed to "on".
另请参阅 setExclusive (), isOn (),和 Q3Action::toggled ().
[虚拟]
void
Q3ActionGroup::
setEnabled
(
bool
enable
)
重实现自 Q3Action::setEnabled ().
[虚拟]
void
Q3ActionGroup::
setIconSet
(const
QIcon
&
icon
)
重实现自 Q3Action::setIconSet ().
[虚拟]
void
Q3ActionGroup::
setMenuText
(const
QString
&
text
)
重实现自 Q3Action::setMenuText ().
[虚拟]
void
Q3ActionGroup::
setOn
(
bool
on
)
重实现自 Q3Action::setOn ().
[虚拟]
void
Q3ActionGroup::
setText
(const
QString
&
txt
)
重实现自 Q3Action::setText ().
[虚拟]
void
Q3ActionGroup::
setToggleAction
(
bool
toggle
)
重实现自 Q3Action::setToggleAction ().
[虚拟]
void
Q3ActionGroup::
setToolTip
(const
QString
&
text
)
重实现自 Q3Action::setToolTip ().
[虚拟]
void
Q3ActionGroup::
setVisible
(
bool
visible
)
重实现自 Q3Action::setVisible ().
[虚拟]
void
Q3ActionGroup::
setWhatsThis
(const
QString
&
text
)
重实现自 Q3Action::setWhatsThis ().