1QButtonGroup(3qt) QButtonGroup(3qt)
2
3
4
6 QButtonGroup - Organizes QButton widgets in a group
7
9 #include <qbuttongroup.h>
10
11 Inherits QGroupBox.
12
13 Inherited by QHButtonGroup and QVButtonGroup.
14
15 Public Members
16 QButtonGroup ( QWidget * parent = 0, const char * name = 0 )
17 QButtonGroup ( const QString & title, QWidget * parent = 0, const char
18 * name = 0 )
19 QButtonGroup ( int strips, Orientation orientation, QWidget * parent =
20 0, const char * name = 0 )
21 QButtonGroup ( int strips, Orientation orientation, const QString &
22 title, QWidget * parent = 0, const char * name = 0 )
23 bool isExclusive () const
24 bool isRadioButtonExclusive () const
25 virtual void setExclusive ( bool )
26 virtual void setRadioButtonExclusive ( bool )
27 int insert ( QButton * button, int id = -1 )
28 void remove ( QButton * button )
29 QButton * find ( int id ) const
30 int id ( QButton * button ) const
31 int count () const
32 virtual void setButton ( int id )
33 virtual void moveFocus ( int key )
34 QButton * selected () const
35 int selectedId () const
36
37 Signals
38 void pressed ( int id )
39 void released ( int id )
40 void clicked ( int id )
41
42 Properties
43 bool exclusive - whether the button group is exclusive
44 bool radioButtonExclusive - whether the radio buttons in the group are
45 exclusive
46 int selectedId - the selected toggle button
47
49 The QButtonGroup widget organizes QButton widgets in a group.
50
51 A button group widget makes it easier to deal with groups of buttons.
52 Each button in a button group has a unique identifier. The button group
53 emits a clicked() signal with this identifier when a button in the
54 group is clicked. This makes a button group particularly useful when
55 you have several similar buttons and want to connect all their
56 clicked() signals to a single slot.
57
58 An exclusive button group switches off all toggle buttons except the
59 one that was clicked. A button group is, by default, non-exclusive.
60 Note that all radio buttons that are inserted into a button group are
61 mutually exclusive even if the button group is non-exclusive. (See
62 setRadioButtonExclusive().)
63
64 There are two ways of using a button group:
65
66 The button group is the parent widget of a number of buttons, i.e. the
67 button group is the parent argument in the button constructor. The
68 buttons are assigned identifiers 0, 1, 2, etc., in the order they are
69 created. A QButtonGroup can display a frame and a title because it
70 inherits QGroupBox.
71
72 The button group is an invisible widget and the contained buttons have
73 some other parent widget. In this usage, each button must be manually
74 inserted, using insert(), into the button group and given an
75 identifier.
76
77 A button can be removed from the group with remove(). A pointer to a
78 button with a given id can be obtained using find(). The id of a button
79 is available using id(). A button can be set on with setButton(). The
80 number of buttons in the group is returned by count().
81
82 [Image Omitted]
83
84 [Image Omitted]
85
86 See also QPushButton, QCheckBox, QRadioButton, Widget Appearance and
87 Style, Layout Management, and Organizers.
88
91 Constructs a button group with no title.
92
93 The parent and name arguments are passed to the QWidget constructor.
94
96 const char * name = 0 )
97 Constructs a button group with the title title.
98
99 The parent and name arguments are passed to the QWidget constructor.
100
102 parent = 0, const char * name = 0 )
103 Constructs a button group with no title. Child widgets will be arranged
104 in strips rows or columns (depending on orientation).
105
106 The parent and name arguments are passed to the QWidget constructor.
107
109 QString & title, QWidget * parent = 0, const char * name = 0 )
110 Constructs a button group with title title. Child widgets will be
111 arranged in strips rows or columns (depending on orientation).
112
113 The parent and name arguments are passed to the QWidget constructor.
114
116 This signal is emitted when a button in the group is clicked. The id
117 argument is the button's identifier.
118
119 See also insert().
120
121 Examples:
122
124 Returns the number of buttons in the group.
125
127 Returns the button with the specified identifier id, or 0 if the button
128 was not found.
129
131 Returns the id of button, or -1 if button is not a member of this
132 group.
133
134 See also selectedId.
135
137 Inserts the button with the identifier id into the button group.
138 Returns the button identifier.
139
140 Buttons are normally inserted into a button group automatically by
141 passing the button group as the parent when the button is constructed.
142 So it is not necessary to manually insert buttons that have this button
143 group as their parent widget. An exception is when you want custom
144 identifiers instead of the default 0, 1, 2, etc., or if you want the
145 buttons to have some other parent.
146
147 The button is assigned the identifier id or an automatically generated
148 identifier. It works as follows: If id >= 0, this identifier is
149 assigned. If id == -1 (default), the identifier is equal to the number
150 of buttons in the group. If id is any other negative integer, for
151 instance -2, a unique identifier (negative integer <= -2) is generated.
152 No button has an id of -1.
153
154 See also find(), remove(), and exclusive.
155
156 Examples:
157
159 Returns TRUE if the button group is exclusive; otherwise returns FALSE.
160 See the "exclusive" property for details.
161
163 Returns TRUE if the radio buttons in the group are exclusive; otherwise
164 returns FALSE. See the "radioButtonExclusive" property for details.
165
167 Moves the keyboard focus according to key, and if appropriate checks
168 the new focus item.
169
170 This function does nothing unless the keyboard focus points to one of
171 the button group members and key is one of Key_Up, Key_Down, Key_Left
172 and Key_Right.
173
175 This signal is emitted when a button in the group is pressed. The id
176 argument is the button's identifier.
177
178 See also insert().
179
181 This signal is emitted when a button in the group is released. The id
182 argument is the button's identifier.
183
184 See also insert().
185
187 Removes the button from the button group.
188
189 See also insert().
190
192 Returns the selected toggle button if exactly one is selected;
193 otherwise returns 0.
194
195 See also selectedId.
196
198 Returns the selected toggle button. See the "selectedId" property for
199 details.
200
202 Sets the selected toggle button to id. See the "selectedId" property
203 for details.
204
206 Sets whether the button group is exclusive. See the "exclusive"
207 property for details.
208
210 Sets whether the radio buttons in the group are exclusive. See the
211 "radioButtonExclusive" property for details.
212
213 Property Documentation
215 This property holds whether the button group is exclusive.
216
217 If this property is TRUE, then the buttons in the group are toggled,
218 and to untoggle a button you must click on another button in the group.
219 The default value is FALSE.
220
221 Set this property's value with setExclusive() and get this property's
222 value with isExclusive().
223
225 This property holds whether the radio buttons in the group are
226 exclusive.
227
228 If this property is TRUE (the default), the radiobuttons in the group
229 are treated exclusively.
230
231 Set this property's value with setRadioButtonExclusive() and get this
232 property's value with isRadioButtonExclusive().
233
235 This property holds the selected toggle button.
236
237 The toggle button is specified as an ID.
238
239 If no toggle button is selected, this property holds -1.
240
241 If setButton() is called on an exclusive group, the button with the
242 given id will be set to on and all the others will be set to off.
243
244 See also selected().
245
246 Set this property's value with setButton() and get this property's
247 value with selectedId().
248
249
251 http://doc.trolltech.com/qbuttongroup.html
252 http://www.trolltech.com/faq/tech.html
253
255 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
256 license file included in the distribution for a complete license
257 statement.
258
260 Generated automatically from the source code.
261
263 If you find a bug in Qt, please report it as described in
264 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
265 help you. Thank you.
266
267 The definitive Qt documentation is provided in HTML format; it is
268 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
269 web browser. This man page is provided as a convenience for those users
270 who prefer man pages, although this format is not officially supported
271 by Trolltech.
272
273 If you find errors in this manual page, please report them to qt-
274 bugs@trolltech.com. Please include the name of the manual page
275 (qbuttongroup.3qt) and the Qt version (3.3.8).
276
277
278
279Trolltech AS 2 February 2007 QButtonGroup(3qt)