File: qbutton.html

package info (click to toggle)
qt-embedded 2.3.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 68,608 kB
  • ctags: 45,998
  • sloc: cpp: 276,654; ansic: 71,987; makefile: 29,074; sh: 12,305; yacc: 2,465; python: 1,863; perl: 481; lex: 480; xml: 68; lisp: 15
file content (421 lines) | stat: -rw-r--r-- 28,940 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QButton Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">

<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>

<h1 align=center>QButton Class Reference</h1><br clear="all">
<p>
The QButton class is the abstract base class of button widgets, providing functionality common to buttons.
<a href="#details">More...</a>
<p>
<code>#include &lt;<a href="qbutton-h.html">qbutton.h</a>&gt;</code>
<p>
Inherits <a href="qwidget.html">QWidget</a>.
<p>Inherited by <a href="qcheckbox.html">QCheckBox</a>, <a href="qpushbutton.html">QPushButton</a>, <a href="qradiobutton.html">QRadioButton</a> and <a href="qtoolbutton.html">QToolButton</a>.
<p><a href="qbutton-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#3c1da3"><b>QButton</b></a>(QWidget*parent=0, constchar*name=0, WFlagsf=0)</div>
<li><div class="fn"><a href="#55acb7"><b>~QButton</b></a>()</div>
<li><div class="fn">QString<a href="#6033fb"><b>text</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#989f4f"><b>setText</b></a>(constQString&amp;)</div>
<li><div class="fn">constQPixmap*<a href="#0e318f"><b>pixmap</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#27e4fe"><b>setPixmap</b></a>(constQPixmap&amp;)</div>
<li><div class="fn">int<a href="#eff9e3"><b>accel</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#da0271"><b>setAccel</b></a>(int)</div>
<li><div class="fn">bool<a href="#1ad908"><b>isToggleButton</b></a>()const</div>
<li><div class="fn">enum<a href="#ToggleType"><b>ToggleType</b></a>{SingleShot, Toggle, Tristate}</div>
<li><div class="fn">ToggleType<a href="#be4e52"><b>toggleType</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#f865ac"><b>setDown</b></a>(bool)</div>
<li><div class="fn">bool<a href="#ea8b93"><b>isDown</b></a>()const</div>
<li><div class="fn">bool<a href="#12ce08"><b>isOn</b></a>()const</div>
<li><div class="fn">enum<a href="#ToggleState"><b>ToggleState</b></a>{Off, NoChange, On}</div>
<li><div class="fn">ToggleState<a href="#7b764f"><b>state</b></a>()const</div>
<li><div class="fn">boolautoResize()const<em>(obsolete)</em></div>
<li><div class="fn">virtualvoidsetAutoResize(bool)<em>(obsolete)</em></div>
<li><div class="fn">bool<a href="#359c59"><b>autoRepeat</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#221ffa"><b>setAutoRepeat</b></a>(bool)</div>
<li><div class="fn">bool<a href="#7ab492"><b>isExclusiveToggle</b></a>()const</div>
<li><div class="fn">QButtonGroup*<a href="#a64d2c"><b>group</b></a>()const</div>
</ul>
<h2>Public Slots</h2>
<ul>
<li><div class="fn">void<a href="#46de12"><b>animateClick</b></a>()</div>
<li><div class="fn">void<a href="#e6faa9"><b>toggle</b></a>()</div>
</ul>
<h2>Signals</h2>
<ul>
<li><div class="fn">void<a href="#a27000"><b>pressed</b></a>()</div>
<li><div class="fn">void<a href="#e6fa8e"><b>released</b></a>()</div>
<li><div class="fn">void<a href="#da7248"><b>clicked</b></a>()</div>
<li><div class="fn">void<a href="#4069b1"><b>toggled</b></a>(bool)</div>
<li><div class="fn">void<a href="#3369ee"><b>stateChanged</b></a>(int)</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">void<a href="#fb5f22"><b>setToggleButton</b></a>(bool)</div>
<li><div class="fn">virtualvoid<a href="#91b6ef"><b>setToggleType</b></a>(ToggleType)</div>
<li><div class="fn">void<a href="#2a029d"><b>setOn</b></a>(bool)</div>
<li><div class="fn">virtualvoid<a href="#859018"><b>setState</b></a>(ToggleState)</div>
<li><div class="fn">virtualbool<a href="#c0aff5"><b>hitButton</b></a>(constQPoint&amp;pos)const</div>
<li><div class="fn">virtualvoid<a href="#13c577"><b>drawButton</b></a>(QPainter*)</div>
<li><div class="fn">virtualvoid<a href="#c175f1"><b>drawButtonLabel</b></a>(QPainter*)</div>
<li><div class="fn">virtualvoid<a href="#2b7b2a"><b>paintEvent</b></a>(QPaintEvent*)</div>
</ul>
<h2>Properties</h2>
<table border=1 cellpadding=3 cellspacing=0>
<tr><th>Type<th>Name<th>READ<th>WRITE<th>Options
<tr><td>QString<td>text<td>text<td>setText<td>&nbsp;
<tr><td>QPixmap<td>pixmap<td>pixmap<td>setPixmap<td>&nbsp;
<tr><td>int<td>accel<td>accel<td>setAccel<td>&nbsp;
<tr><td>bool<td>toggleButton<td>isToggleButton<td>&nbsp;<td>&nbsp;
<tr><td>ToggleType<td>toggleType<td>toggleType<td>&nbsp;<td>&nbsp;
<tr><td>bool<td>down<td>isDown<td>setDown<td> DESIGNABLE false
<tr><td>bool<td>on<td>isOn<td>&nbsp;<td>&nbsp;
<tr><td>ToggleState<td>toggleState<td>state<td>&nbsp;<td>&nbsp;
<tr><td>bool<td>autoResize<td>autoResize<td>setAutoResize<td>&nbsp;
<tr><td>bool<td>autoRepeat<td>autoRepeat<td>setAutoRepeat<td>&nbsp;
<tr><td>bool<td>exclusiveToggle<td>isExclusiveToggle<td>&nbsp;<td>&nbsp;
</table>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QButton class is the abstract base class of button widgets, providing functionality common to buttons.
<p>
The QButton class implements an abstract button, and lets subclasses
specify how to reply to user actions and how to draw the button.
<p>QButton provides both push and toggle buttons.  The <a href="qradiobutton.html">QRadioButton</a> and
<a href="qcheckbox.html">QCheckBox</a> classes provide only toggle buttons, <a href="qpushbutton.html">QPushButton</a> and
<a href="qtoolbutton.html">QToolButton</a> provide both toggle and push buttons.
<p>Any button can have either a text or pixmap label.  <a href="#989f4f">setText</a>() sets
the button to be a text button and <a href="#27e4fe">setPixmap</a>() sets it to be a
pixmap button.  The text/pixmap is manipulated as necessary to
create "disabled" appearance when the button is disabled.
<p>QButton provides most of the states used for buttons:
<ul>
<li><a href="#ea8b93">isDown</a>() determines whether the button is <em>pressed</em> down.
<li><a href="#12ce08">isOn</a>() determines whether the button is <em>on.</em>
Only toggle buttons can be switched on and off  (see below).
<li><a href="qwidget.html#f9af61">isEnabled</a>() determines whether the button can be pressed by the
user.
<li><a href="#221ffa">setAutoRepeat</a>() determines whether the button will auto-repeat
if the user holds it down.
<li><a href="#fb5f22">setToggleButton</a>() determines whether the button is a toggle
button or not.
</ul>
<p>The difference between isDown() and isOn() is as follows:
When the user clicks a toggle button to toggle it on, the button is
first <em>pressed,</em> then released into <em>on</em> state.  When the user
clicks it again (to toggle it off) the button moves first to the <em>pressed</em> state, then to the <em>off</em> state (isOn() and isDown() are
both FALSE).
<p>Default buttons (as used in many dialogs) are provided by
<a href="qpushbutton.html#d415f9">QPushButton::setDefault</a>() and <a href="qpushbutton.html#723d91">QPushButton::setAutoDefault</a>().
<p>QButton provides four signals:
<ul>
<li><a href="#a27000">pressed</a>() is emitted when the left mouse button is pressed while
the mouse cursor is inside the button.
<li><a href="#e6fa8e">released</a>() is emitted when the left mouse button is released.
<li><a href="#da7248">clicked</a>() is emitted when the button is first pressed then
released, or when the accelerator key is typed, or when <a href="#46de12">animateClick</a>()
is called.
<li><a href="#4069b1">toggled</a>(bool) is emitted when the state of a toggle button changes.
<li><a href="#3369ee">stateChanged</a>(int) is emitted when the state of a tristate
toggle button changes.
</ul>
<p>If the button is a text button with "&" in its text, QButton creates
an automatic accelerator key.  This code creates a push button
labelled "Rock & Roll" (where the c is underscored).  The button
gets an automatic accelerator key, Alt-C:
<p><pre>    <a href="qpushbutton.html">QPushButton</a> *p = new <a href="qpushbutton.html">QPushButton</a>( "Ro&amp;ck &amp;&amp; Roll", this );
</pre>
<p>In this example, when the user presses Alt-C the button will
call animateClick().
<p>You can also set a custom accelerator using the <a href="#da0271">setAccel</a>() function.
This is useful mostly for pixmap buttons since they have no
automatic accelerator.
<p><pre>    <a href="qpushbutton.html">QPushButton</a> *p;
    p-&gt;<a href="#27e4fe">setPixmap</a>( <a href="qpixmap.html">QPixmap</a>("print.png") );
    p-&gt;<a href="#da0271">setAccel</a>( ALT+Key_F7 );
</pre>
<p>All of the buttons provided by Qt (<a href="qpushbutton.html">QPushButton</a>, <a href="qtoolbutton.html">QToolButton</a>,
<a href="qcheckbox.html">QCheckBox</a> and <a href="qradiobutton.html">QRadioButton)</a> can display both text and pixmaps.
<p>To subclass QButton, you have to reimplement at least <a href="#13c577">drawButton</a>()
(to draw the button's outskirts) and <a href="#c175f1">drawButtonLabel</a>() (to draw its
text or pixmap).  It is generally advisable to reimplement
<a href="qwidget.html#4511d1">sizeHint</a>() as well, and sometimes <a href="#c0aff5">hitButton</a>() (to determine whether
a button press is within the button).
<p>To reduce flickering the <a href="#2b7b2a">QButton::paintEvent</a>() sets up a pixmap that the
drawButton() function draws in. You should not reimplement <a href="#2b7b2a">paintEvent</a>()
for a subclass of QButton unless you want to take over all drawing.
<p>See also  <a href="qbuttongroup.html">QButtonGroup</a>.
<p>Examples:
 <a href="scrollview-scrollview-cpp.html#QButton">scrollview/scrollview.cpp</a>

<hr><h2>Member Type Documentation</h2>
<h3 class="fn"><a name="ToggleState">QButton::ToggleState</a></h3>
This enum defines the state of a toggle button at any moment.  The possible values are: <ul>
<li> <code>Off</code> - the button is in the "off" state
<li> <code>NoChange</code> - the button is in the default/unchanged state
<li> <code>On</code> - the button is in the "on" state
<p></ul>
<h3 class="fn"><a name="ToggleType">QButton::ToggleType</a></h3>
This enum type defines what a button can do in response to a
mouse/keyboard press: <ul>
<li> <code>SingleShot</code> - pressing the button causes an action, then the
button returns to the unpressed state.
<li> <code>Toggle</code> - pressing the button toggles it between an <code>On</code> and
and <code>Off</code> state.
<li> <code>Tristate</code> - pressing the button cycles between the three
states <code>On, Off</code> and <code>NoChange</code>
<p></ul>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="3c1da3"></a>QButton::QButton(<a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0, WFlagsf=0)</h3>
<p>Constructs a standard button with a parent widget and a name.
<p>If <em>parent</em> is a <a href="qbuttongroup.html">QButtonGroup</a>, this constructor calls
<a href="qbuttongroup.html#10bf2d">QButtonGroup::insert</a>().
<h3 class="fn"><a name="55acb7"></a>QButton::~QButton()</h3>
<p>Destructs the button, deleting all its child widgets.
<h3 class="fn">int<a name="eff9e3"></a>QButton::accel()const</h3>
<p>Returns the accelerator key currently set for the button, or 0
if no accelerator key has been set.
<p>See also  <a href="#da0271">setAccel</a>().
<h3 class="fn">void<a name="46de12"></a>QButton::animateClick() <code>[slot]</code></h3>
<p>Performs an animated click: The button is pressed and a short while
later released.
<p><a href="#a27000">pressed</a>(), <a href="#e6fa8e">released</a>(), <a href="#da7248">clicked</a>(), <a href="#4069b1">toggled</a>(), and <a href="#3369ee">stateChanged</a>()
signals are emitted as appropriate.
<p>This function does nothing if the button is <a href="qwidget.html#4b103c">disabled.</a>
<p>See also  <a href="#da0271">setAccel</a>().
<h3 class="fn">bool<a name="359c59"></a>QButton::autoRepeat()const</h3>
<p>Returns TRUE if the button is auto-repeating, else FALSE.
<p>The default is FALSE.
<p>See also  <a href="#221ffa">setAutoRepeat</a>().
<h3 class="fn">bool<a name="1b080e"></a>QButton::autoResize()const</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt.  We strongly advise against using it in new code.<p>
<p>Strange pre-layout stuff.
<p>Returns TRUE if auto-resizing is enabled, or FALSE if auto-resizing is
disabled.
<p>Auto-resizing is disabled by default.
<p>See also  <a href="#81936a">setAutoResize</a>().
<h3 class="fn">void<a name="da7248"></a>QButton::clicked() <code>[signal]</code></h3>
<p>This signal is emitted when the button
is activated, i.e. first pressed down and then released when the
mouse cursor is inside the button, or when the accelerator key is
typed, or when <a href="#46de12">animateClick</a>() is called.
<p>See also  <a href="#a27000">pressed</a>(), <a href="#e6fa8e">released</a>() and <a href="#4069b1">toggled</a>().
<h3 class="fn">void<a name="13c577"></a>QButton::drawButton(<a href="qpainter.html">QPainter</a>*) <code>[virtualprotected]</code></h3>
<p>Draws the button.  The default implementation does nothing.
<p>This virtual function is reimplemented by subclasses to draw real
buttons. At some point in time, these reimplementations are supposed
to call <a href="#c175f1">drawButtonLabel</a>().
<p>See also  <a href="#c175f1">drawButtonLabel</a>() and <a href="#2b7b2a">paintEvent</a>().
<p>Reimplemented in <a href="qradiobutton.html#b82239">QRadioButton</a>, <a href="qcheckbox.html#5cc1f9">QCheckBox</a>, <a href="qtoolbutton.html#ac94fd">QToolButton</a> and <a href="qpushbutton.html#aaf8ea">QPushButton</a>.
<h3 class="fn">void<a name="c175f1"></a>QButton::drawButtonLabel(<a href="qpainter.html">QPainter</a>*) <code>[virtualprotected]</code></h3>
<p>Draws the button text or pixmap.
<p>This virtual function is reimplemented by subclasses to draw real
buttons. It's invoked by <a href="#13c577">drawButton</a>().
<p>See also  <a href="#13c577">drawButton</a>() and <a href="#2b7b2a">paintEvent</a>().
<p>Reimplemented in <a href="qpushbutton.html#50dbbe">QPushButton</a>, <a href="qtoolbutton.html#77e696">QToolButton</a>, <a href="qradiobutton.html#fcdc76">QRadioButton</a> and <a href="qcheckbox.html#005675">QCheckBox</a>.
<h3 class="fn">void<a name="84617b"></a>QButton::enabledChange(boole) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#048926">QWidget.</a>
<h3 class="fn">void<a name="3d41e1"></a>QButton::focusInEvent(<a href="qfocusevent.html">QFocusEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#21a4b8">QWidget.</a>
<h3 class="fn">bool<a name="1568d9"></a>QButton::focusNextPrevChild(boolnext) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#8d74a1">QWidget.</a>
<h3 class="fn">void<a name="2b50f0"></a>QButton::focusOutEvent(<a href="qfocusevent.html">QFocusEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#de664a">QWidget.</a>
<h3 class="fn"><a href="qbuttongroup.html">QButtonGroup</a>*<a name="a64d2c"></a>QButton::group()const</h3>
<p>Returns a pointer to the group of which this button is a member.
<p>If the button is not a member of any <a href="qbuttongroup.html">QButtonGroup</a>, this function
returns 0.
<p>See also  setGroup() and <a href="qbuttongroup.html">QButtonGroup</a>.
<h3 class="fn">bool<a name="c0aff5"></a>QButton::hitButton(const<a href="qpoint.html">QPoint</a>&amp;pos)const <code>[virtualprotected]</code></h3>
<p>Returns TRUE if <em>pos</em> is inside the clickable button rectangle, or
FALSE if it is outside.
<p>Per default, the clickable area is the entire widget. Subclasses may
reimplement it, though.
<p>Reimplemented in <a href="qradiobutton.html#9114b5">QRadioButton</a>.
<h3 class="fn">bool<a name="ea8b93"></a>QButton::isDown()const</h3>
<p>Returns TRUE if the button pressed down, or FALSE if it is standing up.
<p>See also  <a href="#f865ac">setDown</a>().
<h3 class="fn">bool<a name="7ab492"></a>QButton::isExclusiveToggle()const</h3>
<p>Returns TRUE if this button behaves exclusively inside a <a href="qbuttongroup.html">QButtonGroup</a>.
In that case, this button can only be toggled off by another button
being toggled on.
<h3 class="fn">bool<a name="12ce08"></a>QButton::isOn()const</h3>
<p>Returns TRUE if this toggle button is switched on, or FALSE if it is
switched off.
<p>See also  <a href="#2a029d">setOn</a>() and <a href="#1ad908">isToggleButton</a>().
<p>Examples:
 <a href="qmag-qmag-cpp.html#isOn">qmag/qmag.cpp</a>
<h3 class="fn">bool<a name="1ad908"></a>QButton::isToggleButton()const</h3>
<p>Returns TRUE if the button is a toggle button.
<p>See also  <a href="#fb5f22">setToggleButton</a>().
<h3 class="fn">void<a name="029bf3"></a>QButton::keyPressEvent(<a href="qkeyevent.html">QKeyEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#0a4482">QWidget.</a>
<h3 class="fn">void<a name="947905"></a>QButton::keyReleaseEvent(<a href="qkeyevent.html">QKeyEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#4b620f">QWidget.</a>
<h3 class="fn">void<a name="ce2be0"></a>QButton::mouseMoveEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#a51d92">QWidget.</a>
<h3 class="fn">void<a name="c7dcb7"></a>QButton::mousePressEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#2ecc04">QWidget.</a>
<h3 class="fn">void<a name="b1eb12"></a>QButton::mouseReleaseEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#9aa77f">QWidget.</a>
<h3 class="fn">void<a name="2b7b2a"></a>QButton::paintEvent(<a href="qpaintevent.html">QPaintEvent</a>*event) <code>[virtualprotected]</code></h3>
<p>Handles paint events for buttons.  Small and typically complex
buttons (less than 300x100 pixels) are painted double-buffered to
reduce flicker. The actually drawing is done in the virtual functions
<a href="#13c577">drawButton</a>() and <a href="#c175f1">drawButtonLabel</a>().
<p>See also  <a href="#13c577">drawButton</a>() and <a href="#c175f1">drawButtonLabel</a>().
<p>Reimplemented from <a href="qwidget.html#e3d821">QWidget.</a>
<h3 class="fn">const<a href="qpixmap.html">QPixmap</a>*<a name="0e318f"></a>QButton::pixmap()const</h3>
<p>Returns the button pixmap, or 0 if the button has no pixmap.
<h3 class="fn">void<a name="a27000"></a>QButton::pressed() <code>[signal]</code></h3>
<p>This signal is emitted when the button is pressed down.
<p>See also  <a href="#e6fa8e">released</a>() and <a href="#da7248">clicked</a>().
<h3 class="fn">void<a name="e6fa8e"></a>QButton::released() <code>[signal]</code></h3>
<p>This signal is emitted when the button is released.
<p>See also  <a href="#a27000">pressed</a>(), <a href="#da7248">clicked</a>() and <a href="#4069b1">toggled</a>().
<h3 class="fn">void<a name="da0271"></a>QButton::setAccel(intkey) <code>[virtual]</code></h3>
<p>Specifies an accelerator <em>key</em> for the button, or removes the
accelerator if <em>key</em> is 0.
<p>Setting a button text containing a shortcut character (for
example the 'x' in E&xit) automatically defines an ALT+letter
accelerator for the button.
You only need to call this function in order to specify a custom
accelerator.
<p>Example:
<pre>    <a href="qpushbutton.html">QPushButton</a> *b1 = new <a href="qpushbutton.html">QPushButton</a>;
    b1-&gt;<a href="#989f4f">setText</a>( "&amp;OK" );               // sets accel ALT+'O'

    <a href="qpushbutton.html">QPushButton</a> *b2 = new <a href="qpushbutton.html">QPushButton</a>;
    b2-&gt;<a href="#27e4fe">setPixmap</a>( printIcon );         // pixmap instead of text
    b2-&gt;<a href="#da0271">setAccel</a>( CTRL+'P' );           // custom accel
</pre>
<p>See also  <a href="#eff9e3">accel</a>(), <a href="#989f4f">setText</a>() and <a href="qaccel.html">QAccel</a>.
<h3 class="fn">void<a name="221ffa"></a>QButton::setAutoRepeat(boolenable) <code>[virtual]</code></h3>
<p>Turns on auto-repeat for the button if <em>enable</em> is TRUE, or
turns it off if <em>enable</em> is FALSE.
<p>When auto-repeat is enabled, the <a href="#da7248">clicked</a>() signal is emitted at
regular intervals while the buttons <a href="#ea8b93">is down.</a>
<p>setAutoRepeat() has no effect for <a href="#fb5f22">toggle
buttons.</a>
<p>See also  <a href="#ea8b93">isDown</a>(), <a href="#359c59">autoRepeat</a>() and <a href="#da7248">clicked</a>().
<h3 class="fn">void<a name="81936a"></a>QButton::setAutoResize(boolenable) <code>[virtual]</code></h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt.  We strongly advise against using it in new code.<p>
<p>Strange pre-layout stuff.
<p>Enables auto-resizing if <em>enable</em> is TRUE, or disables it if <em>enable</em> is
FALSE.
<p>When auto-resizing is enabled, the button will resize itself whenever
the contents change.
<p>See also  <a href="#1b080e">autoResize</a>() and <a href="qwidget.html#2ec710">adjustSize</a>().
<h3 class="fn">void<a name="f865ac"></a>QButton::setDown(boolenable) <code>[virtual]</code></h3>
<p>Sets the state of the button to pressed down if <em>enable</em> is TRUE
or to standing up if <em>enable</em> is FALSE.
<p>If the button is a toggle button, it is <em>not</em> toggled.  Call
<a href="#e6faa9">toggle</a>() as well if you need to do that.  The <a href="#a27000">pressed</a>() and
<a href="#e6fa8e">released</a>() signals are not emitted by this function.
<p>This method is provided in case you need to reimplement the mouse event
handlers.
<p>See also  <a href="#ea8b93">isDown</a>(), <a href="#2a029d">setOn</a>(), <a href="#e6faa9">toggle</a>() and <a href="#4069b1">toggled</a>().
<h3 class="fn">void<a name="2a029d"></a>QButton::setOn(boolenable) <code>[protected]</code></h3>
<p>Switches a toggle button on if <em>enable</em> is TRUE or off if <em>enable</em> is
FALSE.  This function should be called only for toggle buttons.
<p>See also  <a href="#12ce08">isOn</a>() and <a href="#1ad908">isToggleButton</a>().
<h3 class="fn">void<a name="27e4fe"></a>QButton::setPixmap(const<a href="qpixmap.html">QPixmap</a>&amp;pixmap) <code>[virtual]</code></h3>
<p>Sets the button to display <em>pixmap</em>
<p>If <em>pixmap</em> is monochrome (i.e. it is a <a href="qbitmap.html">QBitmap</a> or its <a href="qpixmap.html#3c91c2">depth</a> is 1) and it does not have a mask,
this function sets the pixmap to be its own mask. The purpose of
this is to draw transparent bitmaps, which is important for
e.g. toggle buttons.
<p>See also  <a href="#0e318f">pixmap</a>(), <a href="#989f4f">setText</a>(), <a href="#da0271">setAccel</a>() and <a href="qpixmap.html#99119c">QPixmap::mask</a>().
<h3 class="fn">void<a name="859018"></a>QButton::setState(<a href="qbutton.html#ToggleState">ToggleState</a>t) <code>[protected]</code></h3>
<p>This protected function sets the button state into state t but does
<em>not</em> cause repainting.
<p>See also  <a href="#91b6ef">setToggleType</a>().
<h3 class="fn">void<a name="989f4f"></a>QButton::setText(const<a href="qstring.html">QString</a>&amp;text) <code>[virtual]</code></h3>
<p>Sets the button to display <em>text.</em>
<p>If the text contains an ampersand, QButton creates an automatic
accelerator for it, such as  Alt-c for "&Cancel".
<p>See also  <a href="#6033fb">text</a>(), <a href="#27e4fe">setPixmap</a>(), <a href="#da0271">setAccel</a>() and <a href="qpixmap.html#99119c">QPixmap::mask</a>().
<p>Examples:
 <a href="xform-xform-cpp.html#setText">xform/xform.cpp</a>
 <a href="layout-layout-cpp.html#setText">layout/layout.cpp</a>
 <a href="qmag-qmag-cpp.html#setText">qmag/qmag.cpp</a>
<h3 class="fn">void<a name="fb5f22"></a>QButton::setToggleButton(boolenable) <code>[protected]</code></h3>
<p>Makes the button a toggle button if <em>enable</em> is TRUE, or a normal button
if <em>enable</em> is FALSE.
<p>Note that this function is protected. It is called from subclasses
to enable the toggle functionality. <a href="qcheckbox.html">QCheckBox</a> and <a href="qradiobutton.html">QRadioButton</a> are
toggle buttons. <a href="qpushbutton.html">QPushButton</a> is initially not a toggle button, but
<a href="qpushbutton.html#cf550e">QPushButton::setToggleButton</a>() can be called to create toggle buttons.
<p>See also  <a href="#1ad908">isToggleButton</a>().
<h3 class="fn">void<a name="91b6ef"></a>QButton::setToggleType(<a href="qbutton.html#ToggleType">ToggleType</a>type) <code>[protected]</code></h3>
<p>Sets the type of toggling behavior.  The default is <em>SingleShot.</em>
<p>Subclasses use this, and present it with a more comfortable interface.
<h3 class="fn">QButton::ToggleState<a name="7b764f"></a>QButton::state()const</h3>
<p>Returns the state of the button.
<p>See also  <a href="#ToggleState">ToggleState</a>, <a href="#ToggleType">ToggleType</a> and <a href="#859018">setState</a>().
<h3 class="fn">void<a name="3369ee"></a>QButton::stateChanged(intstate) <code>[signal]</code></h3>
<p>This signal is emitted whenever a toggle button changes status.
<em>state</em> is 2 if the button is on, 1 if it is in the
<a href="qcheckbox.html#aea03f">"no change" state</a>
or 0 if the button is off.
<p>This may be the result of a user action, <a href="#e6faa9">toggle</a>() slot activation,
<a href="#859018">setState</a>(), or because <a href="#2a029d">setOn</a>() was called.
<p>See also  <a href="#da7248">clicked</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="6033fb"></a>QButton::text()const</h3>
<p>Returns the button text, or
<a href="qstring.html#e21796">null string</a>
if the button has no text.
<p>See also  <a href="#989f4f">setText</a>().
<h3 class="fn">void<a name="e6faa9"></a>QButton::toggle() <code>[slot]</code></h3>
<p>if this is a toggle button, toggles it.
<h3 class="fn">QButton::ToggleType<a name="be4e52"></a>QButton::toggleType()const</h3>
<p>Returns the current toggle type.
<p>See also  <a href="#91b6ef">setToggleType</a>().
<h3 class="fn">void<a name="4069b1"></a>QButton::toggled(boolon) <code>[signal]</code></h3>
<p>This signal is emitted whenever a toggle button changes status.
<em>on</em> is TRUE if the button is on, or FALSE if the button is off.
<p>This may be the result of a user action, <a href="#e6faa9">toggle</a>() slot activation,
or because <a href="#2a029d">setOn</a>() was called.
<p>See also  <a href="#da7248">clicked</a>().
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright &copy; 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright  2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>