1QRadioButton(3qt) QRadioButton(3qt)
2
3
4
6 QRadioButton - Radio button with a text or pixmap label
7
9 #include <qradiobutton.h>
10
11 Inherits QButton.
12
13 Public Members
14 QRadioButton ( QWidget * parent, const char * name = 0 )
15 QRadioButton ( const QString & text, QWidget * parent, const char *
16 name = 0 )
17 bool isChecked () const
18
19 Public Slots
20 virtual void setChecked ( bool check )
21
22 Important Inherited Members
23 QString text () const
24 virtual void setText ( const QString & )
25 const QPixmap * pixmap () const
26 virtual void setPixmap ( const QPixmap & )
27 QKeySequence accel () const
28 virtual void setAccel ( const QKeySequence & )
29 bool isToggleButton () const
30 virtual void setDown ( bool )
31 bool isDown () const
32 bool isOn () const
33 ToggleState state () const
34 bool autoRepeat () const
35 virtual void setAutoRepeat ( bool )
36 bool isExclusiveToggle () const
37 QButtonGroup * group () const
38 void toggle ()
39 void pressed ()
40 void released ()
41 void clicked ()
42 void toggled ( bool on )
43 void stateChanged ( int state )
44
45 Properties
46 bool autoMask - whether the radio button is automatically masked (read
47 only)
48 bool checked - whether the radio button is checked
49
51 The QRadioButton widget provides a radio button with a text or pixmap
52 label.
53
54 QRadioButton and QCheckBox are both option buttons. That is, they can
55 be switched on (checked) or off (unchecked). The classes differ in how
56 the choices for the user are restricted. Check boxes define "many of
57 many" choices, whereas radio buttons provide a" one of many" choice. In
58 a group of radio buttons only one radio button at a time can be
59 checked; if the user selects another button, the previously selected
60 button is switched off.
61
62 The easiest way to implement a "one of many" choice is simply to put
63 the radio buttons into QButtonGroup.
64
65 Whenever a button is switched on or off it emits the signal toggled().
66 Connect to this signal if you want to trigger an action each time the
67 button changes state. Otherwise, use isChecked() to see if a particular
68 button is selected.
69
70 Just like QPushButton, a radio button can display text or a pixmap. The
71 text can be set in the constructor or with setText(); the pixmap is set
72 with setPixmap().
73
74 [Image Omitted]
75
76 [Image Omitted]
77
78 See also QPushButton, QToolButton, GUI Design Handbook: Radio Button,
79 and Basic Widgets.
80
83 Constructs a radio button with no text.
84
85 The parent and name arguments are sent on to the QWidget constructor.
86
88 char * name = 0 )
89 Constructs a radio button with the text text.
90
91 The parent and name arguments are sent on to the QWidget constructor.
92
94 Returns the accelerator associated with the button. See the "accel"
95 property for details.
96
98 Returns TRUE if autoRepeat is enabled; otherwise returns FALSE. See the
99 "autoRepeat" property for details.
100
102 This signal is emitted when the button is activated (i.e. first pressed
103 down and then released when the mouse cursor is inside the button),
104 when the accelerator key is typed or when animateClick() is called.
105 This signal is not emitted if you call setDown().
106
107 The QButtonGroup::clicked() signal does the same job, if you want to
108 connect several buttons to the same slot.
109
110 Warning: Don't launch a model dialog in response to this signal for a
111 button that has autoRepeat turned on.
112
113 See also pressed(), released(), toggled(), autoRepeat, and down.
114
115 Examples:
116
118 Returns the group that this button belongs to.
119
120 If the button is not a member of any QButtonGroup, this function
121 returns 0.
122
123 See also QButtonGroup.
124
126 Returns TRUE if the radio button is checked; otherwise returns FALSE.
127 See the "checked" property for details.
128
130 Returns TRUE if the button is pressed; otherwise returns FALSE. See the
131 "down" property for details.
132
134 Returns TRUE if the button is an exclusive toggle; otherwise returns
135 FALSE. See the "exclusiveToggle" property for details.
136
138 Returns TRUE if the button is toggled; otherwise returns FALSE. See the
139 "on" property for details.
140
142 Returns TRUE if the button is a toggle button; otherwise returns FALSE.
143 See the "toggleButton" property for details.
144
146 Returns the pixmap shown on the button. See the "pixmap" property for
147 details.
148
150 This signal is emitted when the button is pressed down.
151
152 See also released() and clicked().
153
154 Examples:
155
157 This signal is emitted when the button is released.
158
159 See also pressed(), clicked(), and toggled().
160
162 Sets the accelerator associated with the button. See the "accel"
163 property for details.
164
166 Sets whether autoRepeat is enabled. See the "autoRepeat" property for
167 details.
168
170 Sets whether the radio button is checked to check. See the "checked"
171 property for details.
172
174 Sets whether the button is pressed. See the "down" property for
175 details.
176
178 Sets the pixmap shown on the button. See the "pixmap" property for
179 details.
180
182 Sets the text shown on the button. See the "text" property for details.
183
185 Returns the state of the toggle button. See the "toggleState" property
186 for details.
187
189 This signal is emitted whenever a toggle button changes state. state is
190 On if the button is on, NoChange if it is in the" no change" state or
191 Off if the button is off.
192
193 This may be the result of a user action, toggle() slot activation,
194 setState(), or because setOn() was called.
195
196 See also clicked() and QButton::ToggleState.
197
199 Returns the text shown on the button. See the "text" property for
200 details.
201
203 Toggles the state of a toggle button.
204
205 See also on, setOn(), toggled(), and toggleButton.
206
208 This signal is emitted whenever a toggle button changes status. on is
209 TRUE if the button is on, or FALSE if the button is off.
210
211 This may be the result of a user action, toggle() slot activation, or
212 because setOn() was called.
213
214 See also clicked().
215
216 Example: listbox/listbox.cpp.
217
218 Property Documentation
220 This property holds the accelerator associated with the button.
221
222 This property is 0 if there is no accelerator set. If you set this
223 property to 0 then any current accelerator is removed.
224
225 Set this property's value with setAccel() and get this property's value
226 with accel().
227
229 This property holds whether the radio button is automatically masked.
230
231 See also QWidget::autoMask.
232
234 This property holds whether autoRepeat is enabled.
235
236 If autoRepeat is enabled then the clicked() signal is emitted at
237 regular intervals if the button is down. This property has no effect on
238 toggle buttons. autoRepeat is off by default.
239
240 Set this property's value with setAutoRepeat() and get this property's
241 value with autoRepeat().
242
244 This property holds whether the radio button is checked.
245
246 This property will not effect any other radio buttons unless they have
247 been placed in the same QButtonGroup. The default value is FALSE
248 (unchecked).
249
250 Set this property's value with setChecked() and get this property's
251 value with isChecked().
252
254 This property holds the pixmap shown on the button.
255
256 If the pixmap is monochrome (i.e. it is a QBitmap or its depth is 1)
257 and it does not have a mask, this property will set the pixmap to be
258 its own mask. The purpose of this is to draw transparent bitmaps which
259 are important for toggle buttons, for example.
260
261 pixmap() returns 0 if no pixmap was set.
262
263 Set this property's value with setPixmap() and get this property's
264 value with pixmap().
265
267 This property holds the text shown on the button.
268
269 This property will return a QString::null if the button has no text. If
270 the text has an ampersand (&) in it, then an accelerator is
271 automatically created for it using the character that follows the '&'
272 as the accelerator key. Any previous accelerator will be overwritten,
273 or cleared if no accelerator is defined by the text.
274
275 There is no default text.
276
277 Set this property's value with setText() and get this property's value
278 with text().
279
280
282 http://doc.trolltech.com/qradiobutton.html
283 http://www.trolltech.com/faq/tech.html
284
286 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
287 license file included in the distribution for a complete license
288 statement.
289
291 Generated automatically from the source code.
292
294 If you find a bug in Qt, please report it as described in
295 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
296 help you. Thank you.
297
298 The definitive Qt documentation is provided in HTML format; it is
299 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
300 web browser. This man page is provided as a convenience for those users
301 who prefer man pages, although this format is not officially supported
302 by Trolltech.
303
304 If you find errors in this manual page, please report them to qt-
305 bugs@trolltech.com. Please include the name of the manual page
306 (qradiobutton.3qt) and the Qt version (3.3.8).
307
308
309
310Trolltech AS 2 February 2007 QRadioButton(3qt)