File: qtoolbutton.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 (277 lines) | stat: -rw-r--r-- 20,402 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
<!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 - QToolButton 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>QToolButton Class Reference</h1><br clear="all">
<p>
The QToolButton class provides a quick-access button to specific commands or options, usually used inside a <a href="qtoolbar.html">QToolBar</a>.
<a href="#details">More...</a>
<p>
<code>#include &lt;<a href="qtoolbutton-h.html">qtoolbutton.h</a>&gt;</code>
<p>
Inherits <a href="qbutton.html">QButton</a>.
<p><a href="qtoolbutton-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#2945da"><b>QToolButton</b></a>(QWidget*parent, constchar*name=0)</div>
<li><div class="fn"><a href="#5bf4cb"><b>QToolButton</b></a>(constQPixmap&amp;pm, constQString&amp;textLabel, constQString&amp;grouptext, QObject*receiver, constchar*slot, QToolBar*parent, constchar*name=0)</div>
<li><div class="fn"><a href="#8abcd7"><b>QToolButton</b></a>(constQIconSet&amp;s, constQString&amp;textLabel, constQString&amp;grouptext, QObject*receiver, constchar*slot, QToolBar*parent, constchar*name=0)</div>
<li><div class="fn"><a href="#524ca3"><b>QToolButton</b></a>(ArrowTypetype, QWidget*parent, constchar*name=0)</div>
<li><div class="fn"><a href="#fda2b0"><b>~QToolButton</b></a>()</div>
<li><div class="fn">void<a href="#54f61c"><b>setOnIconSet</b></a>(constQIconSet&amp;)</div>
<li><div class="fn">void<a href="#b6004a"><b>setOffIconSet</b></a>(constQIconSet&amp;)</div>
<li><div class="fn">QIconSet<a href="#d4bc8b"><b>onIconSet</b></a>()const</div>
<li><div class="fn">QIconSet<a href="#087db0"><b>offIconSet</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#688d05"><b>setIconSet</b></a>(constQIconSet&amp;, boolon=FALSE)</div>
<li><div class="fn">QIconSet<a href="#f219a5"><b>iconSet</b></a>(boolon=FALSE)const</div>
<li><div class="fn">bool<a href="#917608"><b>usesBigPixmap</b></a>()const</div>
<li><div class="fn">bool<a href="#e2b13d"><b>usesTextLabel</b></a>()const</div>
<li><div class="fn">QString<a href="#0ebb07"><b>textLabel</b></a>()const</div>
<li><div class="fn">void<a href="#8d6ba1"><b>setPopup</b></a>(QPopupMenu*popup)</div>
<li><div class="fn">QPopupMenu*<a href="#8333c6"><b>popup</b></a>()const</div>
<li><div class="fn">void<a href="#5405f7"><b>setPopupDelay</b></a>(intdelay)</div>
<li><div class="fn">int<a href="#46622c"><b>popupDelay</b></a>()const</div>
<li><div class="fn">void<a href="#630682"><b>setAutoRaise</b></a>(boolenable)</div>
<li><div class="fn">bool<a href="#cbd329"><b>autoRaise</b></a>()const</div>
</ul>
<h2>Public Slots</h2>
<ul>
<li><div class="fn">virtualvoid<a href="#c0b146"><b>setUsesBigPixmap</b></a>(boolenable)</div>
<li><div class="fn">virtualvoid<a href="#198f6f"><b>setUsesTextLabel</b></a>(boolenable)</div>
<li><div class="fn">virtualvoid<a href="#629eda"><b>setTextLabel</b></a>(constQString&amp;, bool)</div>
<li><div class="fn">virtualvoid<a href="#f8a317"><b>setToggleButton</b></a>(boolenable)</div>
<li><div class="fn">virtualvoid<a href="#a7e544"><b>setOn</b></a>(boolenable)</div>
<li><div class="fn">void<a href="#72476a"><b>toggle</b></a>()</div>
<li><div class="fn">void<a href="#51354a"><b>setTextLabel</b></a>(constQString&amp;)</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">bool<a href="#b54ef2"><b>uses3D</b></a>()const</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>QIconSet<td>onIconSet<td>onIconSet<td>setOnIconSet<td>&nbsp;
<tr><td>QIconSet<td>offIconSet<td>offIconSet<td>setOffIconSet<td>&nbsp;
<tr><td>bool<td>usesBigPixmap<td>usesBigPixmap<td>setUsesBigPixmap<td>&nbsp;
<tr><td>bool<td>usesTextLabel<td>usesTextLabel<td>setUsesTextLabel<td>&nbsp;
<tr><td>QString<td>textLabel<td>textLabel<td>setTextLabel<td>&nbsp;
<tr><td>int<td>popupDelay<td>popupDelay<td>setPopupDelay<td>&nbsp;
<tr><td>bool<td>autoRaise<td>autoRaise<td>setAutoRaise<td>&nbsp;
</table>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QToolButton class provides a quick-access button to specific commands or options, usually used inside a <a href="qtoolbar.html">QToolBar</a>.
<p>
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 an icon.  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 <a href="#f8a317">setToggleButton</a>() ).
<p>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 <a href="#630682">setAutoRaise</a>().
<p>A tool button's icon is set as <a href="qiconset.html">QIconSet</a>. 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 user is pointing at it.
<p>The button's look and dimension is adjustable with
<a href="#c0b146">setUsesBigPixmap</a>() and <a href="#198f6f">setUsesTextLabel</a>(). When used inside a
QToolBar, the button automatically adjusts to <a href="qmainwindow.html">QMainWindow</a>'s settings
(see <a href="qmainwindow.html#34c916">QMainWindow::setUsesTextLabel</a>() and
<a href="qmainwindow.html#5f2c62">QMainWindow::setUsesBigPixmaps</a>()).
<p>A tool button can offer additional choices in a popup menu.  The
feature is sometimes used with the "Back" button in a web browsers:
After pressing the button down for a while, a menu pops up showing
all possible pages to browse back.  With QToolButton, you can set a
popup menu using <a href="#8d6ba1">setPopup</a>(). The default delay is 600ms, you may
adjust it with <a href="#5405f7">setPopupDelay</a>().
<p>See also  <a href="qpushbutton.html">QPushButton</a>, <a href="qtoolbar.html">QToolBar</a>, <a href="qmainwindow.html">QMainWindow</a> and <a href="guibooks.html#fowler">GUI Design Handbook: Push Button</a>

<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="2945da"></a>QToolButton::QToolButton(<a href="qwidget.html">QWidget</a>*parent, constchar*name=0)</h3>
<p>Constructs an empty tool button.
<h3 class="fn"><a name="524ca3"></a>QToolButton::QToolButton(ArrowTypetype, <a href="qwidget.html">QWidget</a>*parent, constchar*name=0)</h3>
<p>Constructs a tool button as arrow button. The ArrowType <em>type</em>
defines the arrow direction. Possible values are LeftArrow,
RightArrow, UpArrow and DownArrow.
<p>An arrow button has auto repeat turned on.
<p>The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.
<h3 class="fn"><a name="8abcd7"></a>QToolButton::QToolButton(const<a href="qiconset.html">QIconSet</a>&amp;iconSet, const<a href="qstring.html">QString</a>&amp;textLabel, const<a href="qstring.html">QString</a>&amp;grouptext, <a href="qobject.html">QObject</a>*receiver, constchar*slot, <a href="qtoolbar.html">QToolBar</a>*parent, constchar*name=0)</h3>
<p>Constructs a tool button that is a child of <em>parent</em> (which must be
a <a href="qtoolbar.html">QToolBar</a>) and named <em>name.</em>
<p>The tool button will display <em>iconSet,</em> with text label or tool tip <em>textLabel</em> and status-bar message <em>grouptext,</em> connected to <em>slot</em>
in object <em>receiver,</em> and returns the button.
<h3 class="fn"><a name="5bf4cb"></a>QToolButton::QToolButton(const<a href="qpixmap.html">QPixmap</a>&amp;pm, const<a href="qstring.html">QString</a>&amp;textLabel, const<a href="qstring.html">QString</a>&amp;grouptext, <a href="qobject.html">QObject</a>*receiver, constchar*slot, <a href="qtoolbar.html">QToolBar</a>*parent, constchar*name=0)</h3>
<p>Constructs a tool button that is a child of <em>parent</em> (which must be
a <a href="qtoolbar.html">QToolBar</a>) and named <em>name.</em>
<p>The tool button will display <em>pm,</em> with text label or tool tip <em>textLabel</em> and status-bar message <em>grouptext,</em> connected to <em>slot</em>
in object <em>receiver,</em> and returns the button.
<h3 class="fn"><a name="fda2b0"></a>QToolButton::~QToolButton()</h3>
<p>Destroys the object and frees any allocated resources.
<h3 class="fn">bool<a name="cbd329"></a>QToolButton::autoRaise()const</h3>
<p>Returns whether auto-raising is enabled or not.
<p>See also  setAutoRaise.
<h3 class="fn">void<a name="ac94fd"></a>QToolButton::drawButton(<a href="qpainter.html">QPainter</a>*p) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qbutton.html#13c577">QButton.</a>
<h3 class="fn">void<a name="77e696"></a>QToolButton::drawButtonLabel(<a href="qpainter.html">QPainter</a>*p) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qbutton.html#c175f1">QButton.</a>
<h3 class="fn">void<a name="58e96a"></a>QToolButton::enterEvent(<a href="qevent.html">QEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#5d1d18">QWidget.</a>
<h3 class="fn"><a href="qiconset.html">QIconSet</a><a name="f219a5"></a>QToolButton::iconSet(boolon=FALSE)const</h3>
<p>Returns a copy of the icon set in use.  If no icon set has been
set, iconSet() creates one from the <a href="qbutton.html#0e318f">pixmap</a>().
<p>If the button doesn't have a pixmap either, iconSet()'s return value
is meaningless.
<p>If <em>on</em> equals TRUE, the special icon set for the on-state of the
button is returned.
<p>See also  <a href="#688d05">setIconSet</a>() and <a href="qiconset.html">QIconSet</a>.
<h3 class="fn">void<a name="a3aaa6"></a>QToolButton::leaveEvent(<a href="qevent.html">QEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#7eaa8a">QWidget.</a>
<h3 class="fn">void<a name="4023e0"></a>QToolButton::moveEvent(<a href="qmoveevent.html">QMoveEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#3f1b15">QWidget.</a>
<h3 class="fn"><a href="qiconset.html">QIconSet</a><a name="087db0"></a>QToolButton::offIconSet()const</h3>
<p>Returns the icon set which is used if the toolbutton
is in off-state.
<p>See also  <a href="#f219a5">iconSet</a>().
<h3 class="fn"><a href="qiconset.html">QIconSet</a><a name="d4bc8b"></a>QToolButton::onIconSet()const</h3>
<p>Returns the icon set which is used if the toolbutton
is in on-state.
<p>See also  <a href="#f219a5">iconSet</a>().
<h3 class="fn"><a href="qpopupmenu.html">QPopupMenu</a>*<a name="8333c6"></a>QToolButton::popup()const</h3>
<p>Returns the associated popup menu or 0 if no popup menu has been
defined.
<p>See also  <a href="#8d6ba1">setPopup</a>().
<h3 class="fn">int<a name="46622c"></a>QToolButton::popupDelay()const</h3>
<p>Returns the delay between pressing the button and the appearance of
the associated popupmenu in milliseconds.
<p>See also  <a href="#5405f7">setPopupDelay</a>() and <a href="#8d6ba1">setPopup</a>().
<h3 class="fn">void<a name="630682"></a>QToolButton::setAutoRaise(boolenable)</h3>
<p>Enables or disables auto-raising according to <em>enable.</em>
<p>See also  autoRaise.
<h3 class="fn">void<a name="688d05"></a>QToolButton::setIconSet(const<a href="qiconset.html">QIconSet</a>&amp;set, boolon=FALSE) <code>[virtual]</code></h3>
<p>Sets this tool button to display the icons in <em>set.</em>
(<a href="qbutton.html#27e4fe">setPixmap</a>() is effectively a wrapper for this function.)
<p>For toggle buttons it is possible to set an extra icon set with <em>on</em> equals TRUE, which will be used exclusively for the on-state.
<p>QToolButton makes a copy of <em>set,</em> so you must delete <em>set</em>
yourself.
<p>See also  <a href="#f219a5">iconSet</a>(), <a href="qiconset.html">QIconSet</a>, <a href="#f8a317">setToggleButton</a>() and <a href="qbutton.html#12ce08">isOn</a>().
<h3 class="fn">void<a name="b6004a"></a>QToolButton::setOffIconSet(const<a href="qiconset.html">QIconSet</a>&amp;set)</h3>
<p>Sets the icon that is used when the button
is in off-state.
<p>See also  <a href="#688d05">setIconSet</a>().
<h3 class="fn">void<a name="a7e544"></a>QToolButton::setOn(boolenable) <code>[virtualslot]</code></h3>
<p>Sets this tool button to be on if <em>enable</em> is TRUE, and off it
<em>enable</em> is FALSE.
<p>This function has no effect on <a href="qbutton.html#1ad908">non-toggling
buttons.</a>
<p>See also  <a href="qbutton.html#1ad908">isToggleButton</a>() and <a href="#72476a">toggle</a>().
<h3 class="fn">void<a name="54f61c"></a>QToolButton::setOnIconSet(const<a href="qiconset.html">QIconSet</a>&amp;set)</h3>
<p>Sets the icon that is used when the button
is in on-state.
<p>See also  <a href="#688d05">setIconSet</a>().
<h3 class="fn">void<a name="8d6ba1"></a>QToolButton::setPopup(<a href="qpopupmenu.html">QPopupMenu</a>*popup)</h3>
<p>Associates the popup menu <em>popup</em> with this toolbutton.
<p>The popup will be shown each time the toolbutton has been pressed
down for a certain amount of time. A typical application example is
the "back" button in a web browser's toolbar. If the user clicks it,
the browser simply browses back to the previous page. If the user
holds the button down for a while, they receive a menu containing
the current history list.
<p>Ownership of the popup menu is not transferred.
<p>See also  <a href="#8333c6">popup</a>().
<h3 class="fn">void<a name="5405f7"></a>QToolButton::setPopupDelay(intdelay)</h3>
<p>Sets the time delay between pressing the button and the appearance of
the associated popupmenu in milliseconds. Usually this is around 1/2 of
a second.
<p>See also  <a href="#46622c">popupDelay</a>() and <a href="#8d6ba1">setPopup</a>().
<h3 class="fn">void<a name="51354a"></a>QToolButton::setTextLabel(const<a href="qstring.html">QString</a>&amp;newLabel) <code>[slot]</code></h3>
<p>Sets the label of this button to <em>newLabel,</em> and automatically
sets it as tool tip too.
<h3 class="fn">void<a name="629eda"></a>QToolButton::setTextLabel(const<a href="qstring.html">QString</a>&amp;newLabel, booltipToo) <code>[virtualslot]</code></h3>
<p>Sets the label of this button to <em>newLabel,</em> and automatically
sets it as tool tip too if <em>tipToo</em> is TRUE.
<h3 class="fn">void<a name="f8a317"></a>QToolButton::setToggleButton(boolenable) <code>[virtualslot]</code></h3>
<p>Makes the tool button a toggle button if <em>enable</em> is TRUE, or a normal
tool button if <em>enable</em> is FALSE.
<p>Toggle buttons have an on/off state similar to <a href="qcheckbox.html">check
boxes.</a> A tool button is initially not a toggle button.
<p>See also  <a href="#a7e544">setOn</a>(), <a href="#72476a">toggle</a>(), <a href="qbutton.html#1ad908">isToggleButton</a>() and <a href="qbutton.html#4069b1">toggled</a>().
<h3 class="fn">void<a name="c0b146"></a>QToolButton::setUsesBigPixmap(boolenable) <code>[virtualslot]</code></h3>
<p>Sets this button to use the big pixmaps provided by its <a href="qiconset.html">QIconSet</a>
if <em>enable</em> is TRUE, and to use the small ones else.
<p>QToolButton automatically connects this slot to the relevant signal
in the <a href="qmainwindow.html">QMainWindow</a> in which it resides.  You're strongly urged to
use <a href="qmainwindow.html#5f2c62">QMainWindow::setUsesBigPixmaps</a>() instead.<p><b>Warning:</b> If you set some buttons (in a QMainWindow) to have big and
others small pixmaps, QMainWindow may have trouble getting the
geometry correct.
<h3 class="fn">void<a name="198f6f"></a>QToolButton::setUsesTextLabel(boolenable) <code>[virtualslot]</code></h3>
<p>Sets this button to draw a text label below the icon if <em>enable</em>
is TRUE, and to not draw it if <em>enable</em> is FALSE.
<p>QToolButton automatically connects this slot to the relevant signal
in the <a href="qmainwindow.html">QMainWindow</a> in which is resides.
<h3 class="fn"><a href="qsize.html">QSize</a><a name="4aebd5"></a>QToolButton::sizeHint()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#4511d1">QWidget.</a>
<h3 class="fn"><a href="qsizepolicy.html">QSizePolicy</a><a name="2b363a"></a>QToolButton::sizePolicy()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#23726d">QWidget.</a>
<h3 class="fn"><a href="qstring.html">QString</a><a name="0ebb07"></a>QToolButton::textLabel()const</h3>
<p>Returns the text label in use by this tool button, or 0.
<p>See also  <a href="#51354a">setTextLabel</a>(), <a href="#e2b13d">usesTextLabel</a>(), <a href="#198f6f">setUsesTextLabel</a>() and <a href="qbutton.html#989f4f">setText</a>().
<h3 class="fn">void<a name="72476a"></a>QToolButton::toggle() <code>[slot]</code></h3>
<p>Toggles the state of this tool button.
<p>This function has no effect on <a href="qbutton.html#1ad908">non-toggling
buttons.</a>
<p>See also  <a href="qbutton.html#1ad908">isToggleButton</a>() and <a href="qbutton.html#4069b1">toggled</a>().
<h3 class="fn">bool<a name="b54ef2"></a>QToolButton::uses3D()const <code>[protected]</code></h3>
<p>Returns TRUE if this button should be drawn using raised edges.
<p>See also  <a href="#ac94fd">drawButton</a>().
<h3 class="fn">bool<a name="917608"></a>QToolButton::usesBigPixmap()const</h3>
<p>Returns TRUE if this tool button uses the big (32-pixel) pixmaps,
and FALSE if it does not.
<p>See also  <a href="#c0b146">setUsesBigPixmap</a>(), <a href="qbutton.html#27e4fe">setPixmap</a>() and usesTextLabel.
<h3 class="fn">bool<a name="e2b13d"></a>QToolButton::usesTextLabel()const</h3>
<p>Returns TRUE if this tool button puts a text label below the button
pixmap, and FALSE if it does not.
<p>See also  <a href="#198f6f">setUsesTextLabel</a>(), <a href="#51354a">setTextLabel</a>() and <a href="#917608">usesBigPixmap</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>