1QToolButton(3qt) QToolButton(3qt)
2
3
4
6 QToolButton - Quick-access button to commands or options, usually used
7 inside a QToolBar
8
10 #include <qtoolbutton.h>
11
12 Inherits QButton.
13
14 Public Members
15 enum TextPosition { BesideIcon, BelowIcon, Right = BesideIcon, Under =
16 BelowIcon }
17 QToolButton ( QWidget * parent, const char * name = 0 )
18 QToolButton ( const QIconSet & iconSet, const QString & textLabel,
19 const QString & grouptext, QObject * receiver, const char * slot,
20 QToolBar * parent, const char * name = 0 )
21 QToolButton ( ArrowType type, QWidget * parent, const char * name = 0 )
22 ~QToolButton ()
23 void setOnIconSet ( const QIconSet & ) (obsolete)
24 void setOffIconSet ( const QIconSet & ) (obsolete)
25 void setIconSet ( const QIconSet & set, bool on ) (obsolete)
26 QIconSet onIconSet () const (obsolete)
27 QIconSet offIconSet () const (obsolete)
28 QIconSet iconSet ( bool on ) const (obsolete)
29 virtual void setIconSet ( const QIconSet & )
30 QIconSet iconSet () const
31 bool usesBigPixmap () const
32 bool usesTextLabel () const
33 QString textLabel () const
34 void setPopup ( QPopupMenu * popup )
35 QPopupMenu * popup () const
36 void setPopupDelay ( int delay )
37 int popupDelay () const
38 void openPopup ()
39 void setAutoRaise ( bool enable )
40 bool autoRaise () const
41 TextPosition textPosition () const
42
43 Public Slots
44 virtual void setUsesBigPixmap ( bool enable )
45 virtual void setUsesTextLabel ( bool enable )
46 virtual void setTextLabel ( const QString & newLabel, bool tipToo )
47 virtual void setToggleButton ( bool enable )
48 virtual void setOn ( bool enable )
49 void toggle ()
50 void setTextLabel ( const QString & )
51 void setTextPosition ( TextPosition pos )
52
53 Properties
54 bool autoRaise - whether auto-raising is enabled
55 BackgroundMode backgroundMode - the toolbutton's background mode (read
56 only)
57 QIconSet iconSet - the icon set providing the icon shown on the button
58 QIconSet offIconSet - the icon set that is used when the button is in
59 an "off" state (obsolete)
60 bool on - whether this tool button is on
61 QIconSet onIconSet - the icon set that is used when the button is in an
62 "on" state (obsolete)
63 QPixmap pixmap - the pixmap of the button (read only)
64 int popupDelay - the time delay between pressing the button and the
65 appearance of the associated popup menu in milliseconds
66 QString textLabel - the label of this button
67 TextPosition textPosition - the position of the text label of this
68 button
69 bool toggleButton - whether this tool button is a toggle button
70 bool usesBigPixmap - whether this toolbutton uses big pixmaps
71 bool usesTextLabel - whether the toolbutton displays a text label below
72 the button pixmap
73
74 Protected Members
75 bool uses3D () const
76
78 The QToolButton class provides a quick-access button to commands or
79 options, usually used inside a QToolBar.
80
81 A tool button is a special button that provides quick-access to
82 specific commands or options. As opposed to a normal command button, a
83 tool button usually doesn't show a text label, but shows an icon
84 instead. Its classic usage is to select tools, for example the "pen"
85 tool in a drawing program. This would be implemented with a QToolButton
86 as toggle button (see setToggleButton() ).
87
88 QToolButton supports auto-raising. In auto-raise mode, the button draws
89 a 3D frame only when the mouse points at it. The feature is
90 automatically turned on when a button is used inside a QToolBar. Change
91 it with setAutoRaise().
92
93 A tool button's icon is set as QIconSet. This makes it possible to
94 specify different pixmaps for the disabled and active state. The
95 disabled pixmap is used when the button's functionality is not
96 available. The active pixmap is displayed when the button is auto-
97 raised because the mouse pointer is hovering over it.
98
99 The button's look and dimension is adjustable with setUsesBigPixmap()
100 and setUsesTextLabel(). When used inside a QToolBar in a QMainWindow,
101 the button automatically adjusts to QMainWindow's settings (see
102 QMainWindow::setUsesTextLabel() and QMainWindow::setUsesBigPixmaps()).
103 The pixmap set on a QToolButton will be set to 22x22 if it is bigger
104 than this size. If usesBigPixmap() is TRUE, then the pixmap will be set
105 to 32x32.
106
107 A tool button can offer additional choices in a popup menu. The feature
108 is sometimes used with the "Back" button in a web browser. After
109 pressing and holding the button down for a while, a menu pops up
110 showing a list of possible pages to jump to. With QToolButton you can
111 set a popup menu using setPopup(). The default delay is 600ms; you can
112 adjust it with setPopupDelay().
113
114 <center>
115 [Image Omitted]
116
117 </center> QToolbar with QToolbuttons
118
119 See also QPushButton, QToolBar, QMainWindow, GUI Design Handbook: Push
120 Button, and Basic Widgets.
121
122 Member Type Documentation
124 The position of the tool button's textLabel in relation to the tool
125 button's icon.
126
127 QToolButton::BesideIcon - The text appears beside the icon.
128
129 QToolButton::BelowIcon - The text appears below the icon.
130
133 Constructs an empty tool button called name, with parent parent.
134
136 textLabel, const QString & grouptext, QObject * receiver, const char *
137 slot, QToolBar * parent, const char * name = 0 )
138 Constructs a tool button called name, that is a child of parent (which
139 must be a QToolBar).
140
141 The tool button will display iconSet, with its text label and tool tip
142 set to textLabel and its status bar message set to grouptext. It will
143 be connected to the slot in object receiver.
144
146 = 0 )
147 Constructs a tool button as an arrow button. The ArrowType type defines
148 the arrow direction. Possible values are LeftArrow, RightArrow, UpArrow
149 and DownArrow.
150
151 An arrow button has auto-repeat turned on by default.
152
153 The parent and name arguments are sent to the QWidget constructor.
154
156 Destroys the object and frees any allocated resources.
157
159 Returns TRUE if auto-raising is enabled; otherwise returns FALSE. See
160 the "autoRaise" property for details.
161
163 Returns the icon set providing the icon shown on the button. See the
164 "iconSet" property for details.
165
167 This is an overloaded member function, provided for convenience. It
168 behaves essentially like the above function.
169
170 This function is obsolete. It is provided to keep old source working.
171 We strongly advise against using it in new code.
172
173 Since Qt 3.0, QIconSet contains both the On and Off icons.
174
175 For ease of porting, this function ignores the on parameter and returns
176 the iconSet property. If you relied on the on parameter, you probably
177 want to update your code to use the QIconSet On/Off mechanism.
178
180 Returns the icon set that is used when the button is in an "off" state.
181 See the "offIconSet" property for details.
182
184 Returns the icon set that is used when the button is in an "on" state.
185 See the "onIconSet" property for details.
186
188 Opens (pops up) the associated popup menu. If there is no such menu,
189 this function does nothing. This function does not return until the
190 popup menu has been closed by the user.
191
193 Returns the associated popup menu, or 0 if no popup menu has been
194 defined.
195
196 See also setPopup().
197
199 Returns the time delay between pressing the button and the appearance
200 of the associated popup menu in milliseconds. See the "popupDelay"
201 property for details.
202
204 Sets whether auto-raising is enabled to enable. See the "autoRaise"
205 property for details.
206
208 Sets the icon set providing the icon shown on the button. See the
209 "iconSet" property for details.
210
212 This is an overloaded member function, provided for convenience. It
213 behaves essentially like the above function.
214
215 This function is obsolete. It is provided to keep old source working.
216 We strongly advise against using it in new code.
217
218 Since Qt 3.0, QIconSet contains both the On and Off icons.
219
220 For ease of porting, this function ignores the on parameter and sets
221 the iconSet property. If you relied on the on parameter, you probably
222 want to update your code to use the QIconSet On/Off mechanism.
223
224 See also iconSet and QIconSet::State.
225
227 Sets the icon set that is used when the button is in an "off" state.
228 See the "offIconSet" property for details.
229
231 Sets whether this tool button is on to enable. See the "on" property
232 for details.
233
235 Sets the icon set that is used when the button is in an "on" state. See
236 the "onIconSet" property for details.
237
239 Associates the popup menu popup with this tool button.
240
241 The popup will be shown each time the tool button has been pressed down
242 for a certain amount of time. A typical application example is the
243 "back" button in some web browsers's tool bars. If the user clicks it,
244 the browser simply browses back to the previous page. If the user
245 presses and holds the button down for a while, the tool button shows a
246 menu containing the current history list.
247
248 Ownership of the popup menu is not transferred to the tool button.
249
250 See also popup().
251
253 Sets the time delay between pressing the button and the appearance of
254 the associated popup menu in milliseconds to delay. See the
255 "popupDelay" property for details.
256
258 Sets the label of this button. See the "textLabel" property for
259 details.
260
262 [virtual slot]
263 This is an overloaded member function, provided for convenience. It
264 behaves essentially like the above function.
265
266 Sets the label of this button to newLabel and automatically sets it as
267 a tool tip if tipToo is TRUE.
268
270 Sets the position of the text label of this button to pos. See the
271 "textPosition" property for details.
272
274 Sets whether this tool button is a toggle button to enable. See the
275 "toggleButton" property for details.
276
278 Sets whether this toolbutton uses big pixmaps to enable. See the
279 "usesBigPixmap" property for details.
280
282 Sets whether the toolbutton displays a text label below the button
283 pixmap to enable. See the "usesTextLabel" property for details.
284
286 Returns the label of this button. See the "textLabel" property for
287 details.
288
290 Returns the position of the text label of this button. See the
291 "textPosition" property for details.
292
294 Toggles the state of this tool button.
295
296 This function has no effect on non-toggling buttons.
297
298 See also toggleButton and toggled().
299
301 Returns TRUE if this button should be drawn using raised edges;
302 otherwise returns FALSE.
303
304 See also drawButton().
305
307 Returns TRUE if this toolbutton uses big pixmaps; otherwise returns
308 FALSE. See the "usesBigPixmap" property for details.
309
311 Returns TRUE if the toolbutton displays a text label below the button
312 pixmap; otherwise returns FALSE. See the "usesTextLabel" property for
313 details.
314
315 Property Documentation
317 This property holds whether auto-raising is enabled.
318
319 The default is disabled (i.e. FALSE).
320
321 Set this property's value with setAutoRaise() and get this property's
322 value with autoRaise().
323
325 This property holds the toolbutton's background mode.
326
327 Get this property with backgroundMode().
328
329 See also QWidget::backgroundMode.
330
332 This property holds the icon set providing the icon shown on the
333 button.
334
335 Setting this property sets QToolButton::pixmap to a null pixmap. There
336 is no default iconset.
337
338 See also pixmap, toggleButton, and on.
339
340 Set this property's value with setIconSet() and get this property's
341 value with iconSet().
342
344 This property holds the icon set that is used when the button is in an
345 "off" state.
346
347 This property is obsolete. It is provided to keep old source working.
348 We strongly advise against using it in new code.
349
350 Since Qt 3.0, QIconSet contains both the On and Off icons. There is now
351 an QToolButton::iconSet property that replaces both
352 QToolButton::onIconSet and QToolButton::offIconSet.
353
354 For ease of porting, this property is a synonym for
355 QToolButton::iconSet. You probably want to go over your application
356 code and use the QIconSet On/Off mechanism.
357
358 See also iconSet and QIconSet::State.
359
360 Set this property's value with setOffIconSet() and get this property's
361 value with offIconSet().
362
364 This property holds whether this tool button is on.
365
366 This property has no effect on non-toggling buttons. The default is
367 FALSE (i.e. off).
368
369 See also toggleButton and toggle().
370
371 Set this property's value with setOn().
372
374 This property holds the icon set that is used when the button is in an
375 "on" state.
376
377 This property is obsolete. It is provided to keep old source working.
378 We strongly advise against using it in new code.
379
380 Since Qt 3.0, QIconSet contains both the On and Off icons. There is now
381 an QToolButton::iconSet property that replaces both
382 QToolButton::onIconSet and QToolButton::offIconSet.
383
384 For ease of porting, this property is a synonym for
385 QToolButton::iconSet. You probably want to go over your application
386 code and use the QIconSet On/Off mechanism.
387
388 See also iconSet and QIconSet::State.
389
390 Set this property's value with setOnIconSet() and get this property's
391 value with onIconSet().
392
394 This property holds the pixmap of the button.
395
396 The pixmap property has no meaning for tool buttons. Use the iconSet
397 property instead.
398
400 This property holds the time delay between pressing the button and the
401 appearance of the associated popup menu in milliseconds.
402
403 Usually this is around half a second. A value of 0 draws the down arrow
404 button to the side of the button which can be used to open up the popup
405 menu.
406
407 See also setPopup().
408
409 Set this property's value with setPopupDelay() and get this property's
410 value with popupDelay().
411
413 This property holds the label of this button.
414
415 Setting this property automatically sets the text as a tool tip too.
416 There is no default text.
417
418 Set this property's value with setTextLabel() and get this property's
419 value with textLabel().
420
422 This property holds the position of the text label of this button.
423
424 Set this property's value with setTextPosition() and get this
425 property's value with textPosition().
426
428 This property holds whether this tool button is a toggle button.
429
430 Toggle buttons have an on/off state similar to check boxes. A tool
431 button is not a toggle button by default.
432
433 See also on and toggle().
434
435 Set this property's value with setToggleButton().
436
438 This property holds whether this toolbutton uses big pixmaps.
439
440 QToolButton automatically connects this property to the relevant signal
441 in the QMainWindow in which it resides. We strongly recommend that you
442 use QMainWindow::setUsesBigPixmaps() instead.
443
444 This property's default is TRUE.
445
446 Warning: If you set some buttons (in a QMainWindow) to have big pixmaps
447 and others to have small pixmaps, QMainWindow may not get the geometry
448 right.
449
450 Set this property's value with setUsesBigPixmap() and get this
451 property's value with usesBigPixmap().
452
454 This property holds whether the toolbutton displays a text label below
455 the button pixmap.
456
457 The default is FALSE.
458
459 QToolButton automatically connects this slot to the relevant signal in
460 the QMainWindow in which is resides.
461
462 Set this property's value with setUsesTextLabel() and get this
463 property's value with usesTextLabel().
464
465
467 http://doc.trolltech.com/qtoolbutton.html
468 http://www.trolltech.com/faq/tech.html
469
471 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
472 license file included in the distribution for a complete license
473 statement.
474
476 Generated automatically from the source code.
477
479 If you find a bug in Qt, please report it as described in
480 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
481 help you. Thank you.
482
483 The definitive Qt documentation is provided in HTML format; it is
484 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
485 web browser. This man page is provided as a convenience for those users
486 who prefer man pages, although this format is not officially supported
487 by Trolltech.
488
489 If you find errors in this manual page, please report them to qt-
490 bugs@trolltech.com. Please include the name of the manual page
491 (qtoolbutton.3qt) and the Qt version (3.3.8).
492
493
494
495Trolltech AS 2 February 2007 QToolButton(3qt)