1QActionGroup(3qt)                                            QActionGroup(3qt)
2
3
4

NAME

6       QActionGroup - Groups actions together
7

SYNOPSIS

9       #include <qaction.h>
10
11       Inherits QAction.
12
13   Public Members
14       QActionGroup ( QObject * parent, const char * name = 0 )
15       QActionGroup ( QObject * parent, const char * name, bool exclusive )
16       ~QActionGroup ()
17       void setExclusive ( bool )
18       bool isExclusive () const
19       void add ( QAction * action )
20       void addSeparator ()
21       virtual bool addTo ( QWidget * w )
22       void setUsesDropDown ( bool enable )
23       bool usesDropDown () const
24       void insert ( QAction * a )  (obsolete)
25
26   Signals
27       void selected ( QAction * )
28
29   Properties
30       bool exclusive - whether the action group does exclusive toggling
31       bool usesDropDown - whether the group's actions are displayed in a
32           subwidget of the widgets the action group is added to
33

DESCRIPTION

35       The QActionGroup class groups actions together.
36
37       In some situations it is useful to group actions together. For example,
38       if you have a left justify action, a right justify action and a center
39       action, only one of these actions should be active at any one time, and
40       one simple way of achieving this is to group the actions together in an
41       action group.
42
43       An action group can also be added to a menu or a toolbar as a single
44       unit, with all the actions within the action group appearing as
45       separate menu options and toolbar buttons.
46
47       Here's an example from examples/textedit:
48
49               QActionGroup *grp = new QActionGroup( this );
50               connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
51
52       Here we create a new action group. Since the action group is exclusive
53       by default, only one of the actions in the group is ever active at any
54       one time. We then connect the group's selected() signal to our
55       textAlign() slot.
56
57               actionAlignLeft = new QAction( QPixmap::fromMimeSource( "textleft.xpm" ), tr( "&Left" ), CTRL + Key_L, grp, "textLeft" );
58               actionAlignLeft->setToggleAction( TRUE );
59
60       We create a left align action, add it to the toolbar and the menu and
61       make it a toggle action. We create center and right align actions in
62       exactly the same way.
63
64       The actions in an action group emit their activated() (and for toggle
65       actions, toggled()) signals as usual.
66
67       The setExclusive() function is used to ensure that only one action is
68       active at any one time: it should be used with actions which have their
69       toggleAction set to TRUE.
70
71       Action group actions appear as individual menu options and toolbar
72       buttons. For exclusive action groups use setUsesDropDown() to display
73       the actions in a subwidget of any widget the action group is added to.
74       For example, the actions would appear in a combobox in a toolbar or as
75       a submenu in a menu.
76
77       Actions can be added to an action group using add(), but normally they
78       are added by creating the action with the action group as parent.
79       Actions can have separators dividing them using addSeparator(). Action
80       groups are added to widgets with addTo().
81
82       See also Main Window and Related Classes and Basic Widgets.
83

MEMBER FUNCTION DOCUMENTATION

QActionGroup::QActionGroup ( QObject * parent, const char * name = 0 )

86       Constructs an action group called name, with parent parent.
87
88       The action group is exclusive by default. Call setExclusive(FALSE) to
89       make the action group non-exclusive.
90

QActionGroup::QActionGroup ( QObject * parent, const char * name, bool

92       exclusive )
93       Constructs an action group called name, with parent parent.
94
95       If exclusive is TRUE only one toggle action in the group will ever be
96       active.
97
98       See also exclusive.
99

QActionGroup::~QActionGroup ()

101       Destroys the object and frees allocated resources.
102

void QActionGroup::add ( QAction * action )

104       Adds action action to this group.
105
106       Normally an action is added to a group by creating it with the group as
107       parent, so this function is not usually used.
108
109       See also addTo().
110

void QActionGroup::addSeparator ()

112       Adds a separator to the group.
113

bool QActionGroup::addTo ( QWidget * w ) [virtual]

115       Adds this action group to the widget w.
116
117       If isExclusive() is FALSE or usesDropDown() is FALSE, the actions
118       within the group are added to the widget individually. For example, if
119       the widget is a menu, the actions will appear as individual menu
120       options, and if the widget is a toolbar, the actions will appear as
121       toolbar buttons.
122
123       If both isExclusive() and usesDropDown() are TRUE, the actions are
124       presented either in a combobox (if w is a toolbar) or in a submenu (if
125       w is a menu).
126
127       All actions should be added to the action group before the action group
128       is added to the widget. If actions are added to the action group after
129       the action group has been added to the widget these later actions will
130       not appear.
131
132       See also exclusive, usesDropDown, and removeFrom().
133
134       Example: themes/themes.cpp.
135
136       Reimplemented from QAction.
137

void QActionGroup::insert ( QAction * a )

139       This function is obsolete. It is provided to keep old source working.
140       We strongly advise against using it in new code.
141
142       Use add() instead, or better still create the action with the action
143       group as its parent.
144

bool QActionGroup::isExclusive () const

146       Returns TRUE if the action group does exclusive toggling; otherwise
147       returns FALSE. See the "exclusive" property for details.
148

void QActionGroup::selected ( QAction * ) [signal]

150       This signal is emitted from exclusive groups when toggle actions change
151       state.
152
153       The argument is the action whose state changed to "on".
154
155       See also exclusive, on, and QAction::toggled().
156
157       Examples:
158

void QActionGroup::setExclusive ( bool )

160       Sets whether the action group does exclusive toggling. See the
161       "exclusive" property for details.
162

void QActionGroup::setUsesDropDown ( bool enable )

164       Sets whether the group's actions are displayed in a subwidget of the
165       widgets the action group is added to to enable. See the "usesDropDown"
166       property for details.
167

bool QActionGroup::usesDropDown () const

169       Returns TRUE if the group's actions are displayed in a subwidget of the
170       widgets the action group is added to; otherwise returns FALSE. See the
171       "usesDropDown" property for details.
172
173   Property Documentation

bool exclusive

175       This property holds whether the action group does exclusive toggling.
176
177       If exclusive is TRUE only one toggle action in the action group can
178       ever be active at any one time. If the user chooses another toggle
179       action in the group the one they chose becomes active and the one that
180       was active becomes inactive.
181
182       See also QAction::toggleAction.
183
184       Set this property's value with setExclusive() and get this property's
185       value with isExclusive().
186

bool usesDropDown

188       This property holds whether the group's actions are displayed in a
189       subwidget of the widgets the action group is added to.
190
191       Exclusive action groups added to a toolbar display their actions in a
192       combobox with the action's QAction::text and QAction::iconSet
193       properties shown. Non-exclusive groups are represented by a tool button
194       showing their QAction::iconSet and -- depending on
195       QMainWindow::usesTextLabel() -- text() property.
196
197       In a popup menu the member actions are displayed in a submenu.
198
199       Changing usesDropDown only affects subsequent calls to addTo().
200
201       Note that setting this property for actions in a combobox causes calls
202       to their QAction::setVisible(), QAction::setEnabled(), and
203       QAction::setDisabled() functions to have no effect.
204
205       This property's default is FALSE.
206
207       Set this property's value with setUsesDropDown() and get this
208       property's value with usesDropDown().
209
210

SEE ALSO

212       http://doc.trolltech.com/qactiongroup.html
213       http://www.trolltech.com/faq/tech.html
214
216       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
217       license file included in the distribution for a complete license
218       statement.
219

AUTHOR

221       Generated automatically from the source code.
222

BUGS

224       If you find a bug in Qt, please report it as described in
225       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
226       help you. Thank you.
227
228       The definitive Qt documentation is provided in HTML format; it is
229       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
230       web browser. This man page is provided as a convenience for those users
231       who prefer man pages, although this format is not officially supported
232       by Trolltech.
233
234       If you find errors in this manual page, please report them to qt-
235       bugs@trolltech.com.  Please include the name of the manual page
236       (qactiongroup.3qt) and the Qt version (3.3.8).
237
238
239
240Trolltech AS                    2 February 2007              QActionGroup(3qt)
Impressum