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
|
'\" t
.TH QToolButton 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QToolButton \- Quick-access button to commands or options, usually used inside a QToolBar
.SH SYNOPSIS
\fC#include <ntqtoolbutton.h>\fR
.PP
Inherits QButton.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "enum \fBTextPosition\fR { BesideIcon, BelowIcon, Right = BesideIcon, Under = BelowIcon }"
.br
.ti -1c
.BI "\fBQToolButton\fR ( QWidget * parent, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQToolButton\fR ( const QIconSet & iconSet, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, QToolBar * parent, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQToolButton\fR ( ArrowType type, QWidget * parent, const char * name = 0 )"
.br
.ti -1c
.BI "\fB~QToolButton\fR ()"
.br
.ti -1c
.BI "void setOnIconSet ( const QIconSet & ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "void setOffIconSet ( const QIconSet & ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "void setIconSet ( const QIconSet & set, bool on ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "QIconSet onIconSet () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "QIconSet offIconSet () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "QIconSet iconSet ( bool on ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "virtual void \fBsetIconSet\fR ( const QIconSet & )"
.br
.ti -1c
.BI "QIconSet \fBiconSet\fR () const"
.br
.ti -1c
.BI "bool \fBusesBigPixmap\fR () const"
.br
.ti -1c
.BI "bool \fBusesTextLabel\fR () const"
.br
.ti -1c
.BI "QString \fBtextLabel\fR () const"
.br
.ti -1c
.BI "void \fBsetPopup\fR ( QPopupMenu * popup )"
.br
.ti -1c
.BI "QPopupMenu * \fBpopup\fR () const"
.br
.ti -1c
.BI "void \fBsetPopupDelay\fR ( int delay )"
.br
.ti -1c
.BI "int \fBpopupDelay\fR () const"
.br
.ti -1c
.BI "void \fBopenPopup\fR ()"
.br
.ti -1c
.BI "void \fBsetAutoRaise\fR ( bool enable )"
.br
.ti -1c
.BI "bool \fBautoRaise\fR () const"
.br
.ti -1c
.BI "TextPosition \fBtextPosition\fR () const"
.br
.in -1c
.SS "Public Slots"
.in +1c
.ti -1c
.BI "virtual void \fBsetUsesBigPixmap\fR ( bool enable )"
.br
.ti -1c
.BI "virtual void \fBsetUsesTextLabel\fR ( bool enable )"
.br
.ti -1c
.BI "virtual void \fBsetTextLabel\fR ( const QString & newLabel, bool tipToo )"
.br
.ti -1c
.BI "virtual void \fBsetToggleButton\fR ( bool enable )"
.br
.ti -1c
.BI "virtual void \fBsetOn\fR ( bool enable )"
.br
.ti -1c
.BI "void \fBtoggle\fR ()"
.br
.ti -1c
.BI "void \fBsetTextLabel\fR ( const QString & )"
.br
.ti -1c
.BI "void \fBsetTextPosition\fR ( TextPosition pos )"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "bool \fBautoRaise\fR - whether auto-raising is enabled"
.br
.ti -1c
.BI "BackgroundMode \fBbackgroundMode\fR - the toolbutton's background mode \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "QIconSet \fBiconSet\fR - the icon set providing the icon shown on the button"
.br
.ti -1c
.BI "QIconSet offIconSet - the icon set that is used when the button is in an ""off"" state \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool \fBon\fR - whether this tool button is on"
.br
.ti -1c
.BI "QIconSet onIconSet - the icon set that is used when the button is in an ""on"" state \fI(obsolete)\fR"
.br
.ti -1c
.BI "QPixmap \fBpixmap\fR - the pixmap of the button \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "int \fBpopupDelay\fR - the time delay between pressing the button and the appearance of the associated popup menu in milliseconds"
.br
.ti -1c
.BI "QString \fBtextLabel\fR - the label of this button"
.br
.ti -1c
.BI "TextPosition \fBtextPosition\fR - the position of the text label of this button"
.br
.ti -1c
.BI "bool \fBtoggleButton\fR - whether this tool button is a toggle button"
.br
.ti -1c
.BI "bool \fBusesBigPixmap\fR - whether this toolbutton uses big pixmaps"
.br
.ti -1c
.BI "bool \fBusesTextLabel\fR - whether the toolbutton displays a text label below the button pixmap"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "bool \fBuses3D\fR () const"
.br
.in -1c
.SH DESCRIPTION
The QToolButton class provides a quick-access button to commands or options, usually used inside a QToolBar.
.PP
A tool button is a special button that provides quick-access to specific commands or options. As opposed to a normal command button, a tool button usually doesn't show a text label, but shows an icon instead. Its classic usage is to select tools, for example the "pen" tool in a drawing program. This would be implemented with a QToolButton as toggle button (see setToggleButton() ).
.PP
QToolButton supports auto-raising. In auto-raise mode, the button draws a 3D frame only when the mouse points at it. The feature is automatically turned on when a button is used inside a QToolBar. Change it with setAutoRaise().
.PP
A tool button's icon is set as QIconSet. This makes it possible to specify different pixmaps for the disabled and active state. The disabled pixmap is used when the button's functionality is not available. The active pixmap is displayed when the button is auto-raised because the mouse pointer is hovering over it.
.PP
The button's look and dimension is adjustable with setUsesBigPixmap() and setUsesTextLabel(). When used inside a QToolBar in a QMainWindow, the button automatically adjusts to QMainWindow's settings (see QMainWindow::setUsesTextLabel() and QMainWindow::setUsesBigPixmaps()). The pixmap set on a QToolButton will be set to 22x22 if it is bigger than this size. If usesBigPixmap() is TRUE, then the pixmap will be set to 32x32.
.PP
A tool button can offer additional choices in a popup menu. The feature is sometimes used with the "Back" button in a web browser. After pressing and holding the button down for a while, a menu pops up showing a list of possible pages to jump to. With QToolButton you can set a popup menu using setPopup(). The default delay is 600ms; you can adjust it with setPopupDelay().
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center> QToolbar with QToolbuttons
.PP
See also QPushButton, QToolBar, QMainWindow, GUI Design Handbook: Push Button, and Basic Widgets.
.SS "Member Type Documentation"
.SH "QToolButton::TextPosition"
The position of the tool button's textLabel in relation to the tool button's icon.
.TP
\fCQToolButton::BesideIcon\fR - The text appears beside the icon.
.TP
\fCQToolButton::BelowIcon\fR - The text appears below the icon.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QToolButton::QToolButton ( QWidget * parent, const char * name = 0 )"
Constructs an empty tool button called \fIname\fR, with parent \fIparent\fR.
.SH "QToolButton::QToolButton ( const QIconSet & iconSet, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, QToolBar * parent, const char * name = 0 )"
Constructs a tool button called \fIname\fR, that is a child of \fIparent\fR (which must be a QToolBar).
.PP
The tool button will display \fIiconSet\fR, with its text label and tool tip set to \fItextLabel\fR and its status bar message set to \fIgrouptext\fR. It will be connected to the \fIslot\fR in object \fIreceiver\fR.
.SH "QToolButton::QToolButton ( ArrowType type, QWidget * parent, const char * name = 0 )"
Constructs a tool button as an arrow button. The ArrowType \fItype\fR defines the arrow direction. Possible values are LeftArrow, RightArrow, UpArrow and DownArrow.
.PP
An arrow button has auto-repeat turned on by default.
.PP
The \fIparent\fR and \fIname\fR arguments are sent to the QWidget constructor.
.SH "QToolButton::~QToolButton ()"
Destroys the object and frees any allocated resources.
.SH "bool QToolButton::autoRaise () const"
Returns TRUE if auto-raising is enabled; otherwise returns FALSE. See the "autoRaise" property for details.
.SH "QIconSet QToolButton::iconSet () const"
Returns the icon set providing the icon shown on the button. See the "iconSet" property for details.
.SH "QIconSet QToolButton::iconSet ( bool on ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Since Qt 3.0, QIconSet contains both the On and Off icons.
.PP
For ease of porting, this function ignores the \fIon\fR parameter and returns the iconSet property. If you relied on the \fIon\fR parameter, you probably want to update your code to use the QIconSet On/Off mechanism.
.SH "QIconSet QToolButton::offIconSet () const"
Returns the icon set that is used when the button is in an "off" state. See the "offIconSet" property for details.
.SH "QIconSet QToolButton::onIconSet () const"
Returns the icon set that is used when the button is in an "on" state. See the "onIconSet" property for details.
.SH "void QToolButton::openPopup ()"
Opens (pops up) the associated popup menu. If there is no such menu, this function does nothing. This function does not return until the popup menu has been closed by the user.
.SH "QPopupMenu * QToolButton::popup () const"
Returns the associated popup menu, or 0 if no popup menu has been defined.
.PP
See also setPopup().
.SH "int QToolButton::popupDelay () const"
Returns the time delay between pressing the button and the appearance of the associated popup menu in milliseconds. See the "popupDelay" property for details.
.SH "void QToolButton::setAutoRaise ( bool enable )"
Sets whether auto-raising is enabled to \fIenable\fR. See the "autoRaise" property for details.
.SH "void QToolButton::setIconSet ( const QIconSet & )\fC [virtual]\fR"
Sets the icon set providing the icon shown on the button. See the "iconSet" property for details.
.SH "void QToolButton::setIconSet ( const QIconSet & set, bool on )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Since Qt 3.0, QIconSet contains both the On and Off icons.
.PP
For ease of porting, this function ignores the \fIon\fR parameter and sets the iconSet property. If you relied on the \fIon\fR parameter, you probably want to update your code to use the QIconSet On/Off mechanism.
.PP
See also iconSet and QIconSet::State.
.SH "void QToolButton::setOffIconSet ( const QIconSet & )"
Sets the icon set that is used when the button is in an "off" state. See the "offIconSet" property for details.
.SH "void QToolButton::setOn ( bool enable )\fC [virtual slot]\fR"
Sets whether this tool button is on to \fIenable\fR. See the "on" property for details.
.SH "void QToolButton::setOnIconSet ( const QIconSet & )"
Sets the icon set that is used when the button is in an "on" state. See the "onIconSet" property for details.
.SH "void QToolButton::setPopup ( QPopupMenu * popup )"
Associates the popup menu \fIpopup\fR with this tool button.
.PP
The popup will be shown each time the tool button has been pressed down for a certain amount of time. A typical application example is the "back" button in some web browsers's tool bars. If the user clicks it, the browser simply browses back to the previous page. If the user presses and holds the button down for a while, the tool button shows a menu containing the current history list.
.PP
Ownership of the popup menu is not transferred to the tool button.
.PP
See also popup().
.SH "void QToolButton::setPopupDelay ( int delay )"
Sets the time delay between pressing the button and the appearance of the associated popup menu in milliseconds to \fIdelay\fR. See the "popupDelay" property for details.
.SH "void QToolButton::setTextLabel ( const QString & )\fC [slot]\fR"
Sets the label of this button. See the "textLabel" property for details.
.SH "void QToolButton::setTextLabel ( const QString & newLabel, bool tipToo )\fC [virtual slot]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the label of this button to \fInewLabel\fR and automatically sets it as a tool tip if \fItipToo\fR is TRUE.
.SH "void QToolButton::setTextPosition ( TextPosition pos )\fC [slot]\fR"
Sets the position of the text label of this button to \fIpos\fR. See the "textPosition" property for details.
.SH "void QToolButton::setToggleButton ( bool enable )\fC [virtual slot]\fR"
Sets whether this tool button is a toggle button to \fIenable\fR. See the "toggleButton" property for details.
.SH "void QToolButton::setUsesBigPixmap ( bool enable )\fC [virtual slot]\fR"
Sets whether this toolbutton uses big pixmaps to \fIenable\fR. See the "usesBigPixmap" property for details.
.SH "void QToolButton::setUsesTextLabel ( bool enable )\fC [virtual slot]\fR"
Sets whether the toolbutton displays a text label below the button pixmap to \fIenable\fR. See the "usesTextLabel" property for details.
.SH "QString QToolButton::textLabel () const"
Returns the label of this button. See the "textLabel" property for details.
.SH "TextPosition QToolButton::textPosition () const"
Returns the position of the text label of this button. See the "textPosition" property for details.
.SH "void QToolButton::toggle ()\fC [slot]\fR"
Toggles the state of this tool button.
.PP
This function has no effect on non-toggling buttons.
.PP
See also toggleButton and toggled().
.SH "bool QToolButton::uses3D () const\fC [protected]\fR"
Returns TRUE if this button should be drawn using raised edges; otherwise returns FALSE.
.PP
See also drawButton().
.SH "bool QToolButton::usesBigPixmap () const"
Returns TRUE if this toolbutton uses big pixmaps; otherwise returns FALSE. See the "usesBigPixmap" property for details.
.SH "bool QToolButton::usesTextLabel () const"
Returns TRUE if the toolbutton displays a text label below the button pixmap; otherwise returns FALSE. See the "usesTextLabel" property for details.
.SS "Property Documentation"
.SH "bool autoRaise"
This property holds whether auto-raising is enabled.
.PP
The default is disabled (i.e. FALSE).
.PP
Set this property's value with setAutoRaise() and get this property's value with autoRaise().
.SH "BackgroundMode backgroundMode"
This property holds the toolbutton's background mode.
.PP
Get this property with backgroundMode().
.PP
See also QWidget::backgroundMode.
.SH "QIconSet iconSet"
This property holds the icon set providing the icon shown on the button.
.PP
Setting this property sets QToolButton::pixmap to a null pixmap. There is no default iconset.
.PP
See also pixmap, toggleButton, and on.
.PP
Set this property's value with setIconSet() and get this property's value with iconSet().
.SH "QIconSet offIconSet"
This property holds the icon set that is used when the button is in an "off" state.
.PP
\fBThis property is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Since Qt 3.0, QIconSet contains both the On and Off icons. There is now an QToolButton::iconSet property that replaces both QToolButton::onIconSet and QToolButton::offIconSet.
.PP
For ease of porting, this property is a synonym for QToolButton::iconSet. You probably want to go over your application code and use the QIconSet On/Off mechanism.
.PP
See also iconSet and QIconSet::State.
.PP
Set this property's value with setOffIconSet() and get this property's value with offIconSet().
.SH "bool on"
This property holds whether this tool button is on.
.PP
This property has no effect on non-toggling buttons. The default is FALSE (i.e. off).
.PP
See also toggleButton and toggle().
.PP
Set this property's value with setOn().
.SH "QIconSet onIconSet"
This property holds the icon set that is used when the button is in an "on" state.
.PP
\fBThis property is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Since Qt 3.0, QIconSet contains both the On and Off icons. There is now an QToolButton::iconSet property that replaces both QToolButton::onIconSet and QToolButton::offIconSet.
.PP
For ease of porting, this property is a synonym for QToolButton::iconSet. You probably want to go over your application code and use the QIconSet On/Off mechanism.
.PP
See also iconSet and QIconSet::State.
.PP
Set this property's value with setOnIconSet() and get this property's value with onIconSet().
.SH "QPixmap pixmap"
This property holds the pixmap of the button.
.PP
The pixmap property has no meaning for tool buttons. Use the iconSet property instead.
.SH "int popupDelay"
This property holds the time delay between pressing the button and the appearance of the associated popup menu in milliseconds.
.PP
Usually this is around half a second. A value of 0 draws the down arrow button to the side of the button which can be used to open up the popup menu.
.PP
See also setPopup().
.PP
Set this property's value with setPopupDelay() and get this property's value with popupDelay().
.SH "QString textLabel"
This property holds the label of this button.
.PP
Setting this property automatically sets the text as a tool tip too. There is no default text.
.PP
Set this property's value with setTextLabel() and get this property's value with textLabel().
.SH "TextPosition textPosition"
This property holds the position of the text label of this button.
.PP
Set this property's value with setTextPosition() and get this property's value with textPosition().
.SH "bool toggleButton"
This property holds whether this tool button is a toggle button.
.PP
Toggle buttons have an on/off state similar to check boxes. A tool button is not a toggle button by default.
.PP
See also on and toggle().
.PP
Set this property's value with setToggleButton().
.SH "bool usesBigPixmap"
This property holds whether this toolbutton uses big pixmaps.
.PP
QToolButton automatically connects this property to the relevant signal in the QMainWindow in which it resides. We strongly recommend that you use QMainWindow::setUsesBigPixmaps() instead.
.PP
This property's default is TRUE.
.PP
\fBWarning:\fR If you set some buttons (in a QMainWindow) to have big pixmaps and others to have small pixmaps, QMainWindow may not get the geometry right.
.PP
Set this property's value with setUsesBigPixmap() and get this property's value with usesBigPixmap().
.SH "bool usesTextLabel"
This property holds whether the toolbutton displays a text label below the button pixmap.
.PP
The default is FALSE.
.PP
QToolButton automatically connects this slot to the relevant signal in the QMainWindow in which is resides.
.PP
Set this property's value with setUsesTextLabel() and get this property's value with usesTextLabel().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqtoolbutton.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (qtoolbutton.3qt) and the Qt
version (3.3.8).
|