summaryrefslogtreecommitdiffstats
path: root/doc/html/qspinbox.html
blob: 74f1b6fc2a8b5cdfdbb6d199337e61969a499832 (plain)
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
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qspinbox.cpp:129 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQSpinBox Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQSpinBox Class Reference</h1>

<p>The TQSpinBox class provides a spin box widget (spin button).
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qspinbox-h.html">qspinbox.h</a>&gt;</tt>
<p>Inherits <a href="qwidget.html">TQWidget</a> and <a href="qrangecontrol.html">TQRangeControl</a>.
<p><a href="qspinbox-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQSpinBox"><b>TQSpinBox</b></a> ( TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#TQSpinBox-2"><b>TQSpinBox</b></a> ( int&nbsp;minValue, int&nbsp;maxValue, int&nbsp;step = 1, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#~TQSpinBox"><b>~TQSpinBox</b></a> ()</li>
<li class=fn>TQString <a href="#text"><b>text</b></a> () const</li>
<li class=fn>virtual TQString <a href="#prefix"><b>prefix</b></a> () const</li>
<li class=fn>virtual TQString <a href="#suffix"><b>suffix</b></a> () const</li>
<li class=fn>virtual TQString <a href="#cleanText"><b>cleanText</b></a> () const</li>
<li class=fn>virtual void <a href="#setSpecialValueText"><b>setSpecialValueText</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;text )</li>
<li class=fn>TQString <a href="#specialValueText"><b>specialValueText</b></a> () const</li>
<li class=fn>virtual void <a href="#setWrapping"><b>setWrapping</b></a> ( bool&nbsp;on )</li>
<li class=fn>bool <a href="#wrapping"><b>wrapping</b></a> () const</li>
<li class=fn>enum <a href="#ButtonSymbols-enum"><b>ButtonSymbols</b></a> { UpDownArrows, PlusMinus }</li>
<li class=fn>virtual void <a href="#setButtonSymbols"><b>setButtonSymbols</b></a> ( ButtonSymbols )</li>
<li class=fn>ButtonSymbols <a href="#buttonSymbols"><b>buttonSymbols</b></a> () const</li>
<li class=fn>virtual void <a href="#setValidator"><b>setValidator</b></a> ( const&nbsp;TQValidator&nbsp;*&nbsp;v )</li>
<li class=fn>const TQValidator * <a href="#validator"><b>validator</b></a> () const</li>
<li class=fn>int <a href="#minValue"><b>minValue</b></a> () const</li>
<li class=fn>int <a href="#maxValue"><b>maxValue</b></a> () const</li>
<li class=fn>void <a href="#setMinValue"><b>setMinValue</b></a> ( int )</li>
<li class=fn>void <a href="#setMaxValue"><b>setMaxValue</b></a> ( int )</li>
<li class=fn>int <a href="#lineStep"><b>lineStep</b></a> () const</li>
<li class=fn>void <a href="#setLineStep"><b>setLineStep</b></a> ( int )</li>
<li class=fn>int <a href="#value"><b>value</b></a> () const</li>
<li class=fn>TQRect <a href="#upRect"><b>upRect</b></a> () const</li>
<li class=fn>TQRect <a href="#downRect"><b>downRect</b></a> () const</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>virtual void <a href="#setValue"><b>setValue</b></a> ( int&nbsp;value )</li>
<li class=fn>virtual void <a href="#setPrefix"><b>setPrefix</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;text )</li>
<li class=fn>virtual void <a href="#setSuffix"><b>setSuffix</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;text )</li>
<li class=fn>virtual void <a href="#stepUp"><b>stepUp</b></a> ()</li>
<li class=fn>virtual void <a href="#stepDown"><b>stepDown</b></a> ()</li>
<li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ()</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#valueChanged"><b>valueChanged</b></a> ( int&nbsp;value )</li>
<li class=fn>void <a href="#valueChanged-2"><b>valueChanged</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;valueText )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>ButtonSymbols <a href="#buttonSymbols-prop"><b>buttonSymbols</b></a>&nbsp;- the current button symbol mode</li>
<li class=fn>TQString <a href="#cleanText-prop"><b>cleanText</b></a>&nbsp;- the spin box's text with no prefix(), suffix() or leading or trailing whitespace &nbsp;<em>(read only)</em></li>
<li class=fn>int <a href="#lineStep-prop"><b>lineStep</b></a>&nbsp;- the line step</li>
<li class=fn>int <a href="#maxValue-prop"><b>maxValue</b></a>&nbsp;- the maximum value of the spin box</li>
<li class=fn>int <a href="#minValue-prop"><b>minValue</b></a>&nbsp;- the minimum value of the spin box</li>
<li class=fn>TQString <a href="#prefix-prop"><b>prefix</b></a>&nbsp;- the spin box's prefix</li>
<li class=fn>TQString <a href="#specialValueText-prop"><b>specialValueText</b></a>&nbsp;- the special-value text</li>
<li class=fn>TQString <a href="#suffix-prop"><b>suffix</b></a>&nbsp;- the suffix of the spin box</li>
<li class=fn>TQString <a href="#text-prop"><b>text</b></a>&nbsp;- the spin box's text, including any prefix() and suffix() &nbsp;<em>(read only)</em></li>
<li class=fn>int <a href="#value-prop"><b>value</b></a>&nbsp;- the value of the spin box</li>
<li class=fn>bool <a href="#wrapping-prop"><b>wrapping</b></a>&nbsp;- whether it is possible to step the value from the highest value to the lowest value and vice versa</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual TQString <a href="#mapValueToText"><b>mapValueToText</b></a> ( int&nbsp;v )</li>
<li class=fn>virtual int <a href="#mapTextToValue"><b>mapTextToValue</b></a> ( bool&nbsp;*&nbsp;ok )</li>
<li class=fn>TQString <a href="#currentValueText"><b>currentValueText</b></a> ()</li>
<li class=fn>virtual void <a href="#updateDisplay"><b>updateDisplay</b></a> ()</li>
<li class=fn>virtual void <a href="#interpretText"><b>interpretText</b></a> ()</li>
<li class=fn>TQLineEdit * <a href="#editor"><b>editor</b></a> () const</li>
<li class=fn>virtual void <a href="#valueChange"><b>valueChange</b></a> ()</li>
<li class=fn>virtual void <a href="#rangeChange"><b>rangeChange</b></a> ()</li>
<li class=fn>virtual bool <a href="#eventFilter"><b>eventFilter</b></a> ( TQObject&nbsp;*&nbsp;o, TQEvent&nbsp;*&nbsp;ev )</li>
</ul>
<h2>Protected Slots</h2>
<ul>
<li class=fn>void <a href="#textChanged"><b>textChanged</b></a> ()</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The TQSpinBox class provides a spin box widget (spin button).
<p> 

<p> TQSpinBox allows the user to choose a value either by clicking the
up/down buttons to increase/decrease the value currently displayed
or by typing the value directly into the spin box. If the value is
entered directly into the spin box, Enter (or Return) must be
pressed to apply the new value. The value is usually an integer.
<p> Every time the value changes TQSpinBox emits the <a href="#valueChanged">valueChanged</a>()
signal. The current value can be fetched with <a href="#value">value</a>() and set
with <a href="#setValue">setValue</a>().
<p> The spin box keeps the value within a numeric range, and to
multiples of the <a href="#lineStep">lineStep</a>() size (see <a href="qrangecontrol.html">TQRangeControl</a> for details).
Clicking the up/down buttons or using the keyboard accelerator's
up and down arrows will increase or decrease the current value in
steps of size lineStep(). The minimum and maximum value and the
step size can be set using one of the constructors, and can be
changed later with <a href="#setMinValue">setMinValue</a>(), <a href="#setMaxValue">setMaxValue</a>() and <a href="#setLineStep">setLineStep</a>().
<p> Most spin boxes are directional, but TQSpinBox can also operate as
a circular spin box, i.e. if the range is 0-99 and the current
value is 99, clicking "up" will give 0. Use <a href="#setWrapping">setWrapping</a>() if you
want circular behavior.
<p> The displayed value can be prepended and appended with arbitrary
strings indicating, for example, currency or the unit of
measurement. See <a href="#setPrefix">setPrefix</a>() and <a href="#setSuffix">setSuffix</a>(). The text in the spin
box is retrieved with <a href="#text">text</a>() (which includes any <a href="#prefix">prefix</a>() and
<a href="#suffix">suffix</a>()), or with <a href="#cleanText">cleanText</a>() (which has no prefix(), no suffix()
and no leading or trailing whitespace). <a href="#currentValueText">currentValueText</a>() returns
the spin box's current value as text.
<p> Normally the spin box displays up and down arrows in the buttons.
You can use <a href="#setButtonSymbols">setButtonSymbols</a>() to change the display to show
<b>+</b> and <b>-</b> symbols if you prefer. In either case the up
and down arrow keys work as expected.
<p> It is often desirable to give the user a special (often default)
choice in addition to the range of numeric values. See
<a href="#setSpecialValueText">setSpecialValueText</a>() for how to do this with TQSpinBox.
<p> The default <a href="qwidget.html#focusPolicy">TQWidget::focusPolicy</a>() is StrongFocus.
<p> If using prefix(), suffix() and <a href="#specialValueText">specialValueText</a>() don't provide
enough control, you can ignore them and subclass TQSpinBox instead.
<p> TQSpinBox can easily be subclassed to allow the user to input
things other than an integer value as long as the allowed input
can be mapped to a range of integers. This can be done by
overriding the virtual functions <a href="#mapValueToText">mapValueToText</a>() and
<a href="#mapTextToValue">mapTextToValue</a>(), and setting another suitable validator using
<a href="#setValidator">setValidator</a>().
<p> For example, these functions could be changed so that the user
provided values from 0.0 to 10.0, or -1 to signify 'Auto', while
the range of integers used inside the program would be -1 to 100:
<p> <pre>
        class MySpinBox : public TQSpinBox
        {
            Q_OBJECT
        public:
            ...

            <a href="qstring.html">TQString</a> mapValueToText( int value )
            {
                if ( <a href="#value-prop">value</a> == -1 ) // special case
                    return TQString( "Auto" );

                return TQString( "%1.%2" ) // 0.0 to 10.0
                    .arg( value / 10 ).arg( value % 10 );
            }

            int mapTextToValue( bool *ok )
            {
                if ( <a href="#text">text</a>() == "Auto" ) // special case
                    return -1;

                return (int) ( 10 * text().toFloat() ); // 0 to 100
            }
        };
    </pre>
 
<p> <img src=qspinbox-m.png> <img src=qspinbox-w.png>
<p> <p>See also <a href="qscrollbar.html">TQScrollBar</a>, <a href="qslider.html">TQSlider</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Spin Box</a>, and <a href="basic.html">Basic Widgets</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="ButtonSymbols-enum"></a>TQSpinBox::ButtonSymbols</h3>

<p> This enum type determines what the buttons in a spin box show.
<ul>
<li><tt>TQSpinBox::UpDownArrows</tt> - the buttons show little arrows in the classic
style.
<li><tt>TQSpinBox::PlusMinus</tt> - the buttons show <b>+</b> and <b>-</b> symbols.
</ul><p> <p>See also <a href="#buttonSymbols-prop">TQSpinBox::buttonSymbols</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQSpinBox"></a>TQSpinBox::TQSpinBox ( <a href="qwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a spin box with the default <a href="qrangecontrol.html">TQRangeControl</a> range and
step values. It is called <em>name</em> and has parent <em>parent</em>.
<p> <p>See also <a href="#minValue-prop">minValue</a>, <a href="#maxValue-prop">maxValue</a>, <a href="qrangecontrol.html#setRange">setRange</a>(), <a href="#lineStep-prop">lineStep</a>, and <a href="qrangecontrol.html#setSteps">setSteps</a>().

<h3 class=fn><a name="TQSpinBox-2"></a>TQSpinBox::TQSpinBox ( int&nbsp;minValue, int&nbsp;maxValue, int&nbsp;step = 1, <a href="qwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a spin box that allows values from <em>minValue</em> to <em>maxValue</em> inclusive, with step amount <em>step</em>. The value is
initially set to <em>minValue</em>.
<p> The spin box is called <em>name</em> and has parent <em>parent</em>.
<p> <p>See also <a href="#minValue-prop">minValue</a>, <a href="#maxValue-prop">maxValue</a>, <a href="qrangecontrol.html#setRange">setRange</a>(), <a href="#lineStep-prop">lineStep</a>, and <a href="qrangecontrol.html#setSteps">setSteps</a>().

<h3 class=fn><a name="~TQSpinBox"></a>TQSpinBox::~TQSpinBox ()
</h3>
Destroys the spin box, freeing all memory and other resources.

<h3 class=fn><a href="qspinbox.html#ButtonSymbols-enum">ButtonSymbols</a> <a name="buttonSymbols"></a>TQSpinBox::buttonSymbols () const
</h3><p>Returns the current button symbol mode.
See the <a href="qspinbox.html#buttonSymbols-prop">"buttonSymbols"</a> property for details.
<h3 class=fn><a href="qstring.html">TQString</a> <a name="cleanText"></a>TQSpinBox::cleanText () const<tt> [virtual]</tt>
</h3><p>Returns the spin box's text with no <a href="#prefix">prefix</a>(), <a href="#suffix">suffix</a>() or leading or trailing whitespace.
See the <a href="qspinbox.html#cleanText-prop">"cleanText"</a> property for details.
<h3 class=fn><a href="qstring.html">TQString</a> <a name="currentValueText"></a>TQSpinBox::currentValueText ()<tt> [protected]</tt>
</h3>
Returns the full text calculated from the current value, including
any prefix and suffix. If there is special value text and the
value is <a href="#minValue">minValue</a>() the <a href="#specialValueText">specialValueText</a>() is returned.

<h3 class=fn><a href="qrect.html">TQRect</a> <a name="downRect"></a>TQSpinBox::downRect () const
</h3>
Returns the geometry of the "down" button.

<h3 class=fn><a href="qlineedit.html">TQLineEdit</a>&nbsp;* <a name="editor"></a>TQSpinBox::editor () const<tt> [protected]</tt>
</h3>
Returns a pointer to the embedded <a href="qlineedit.html">TQLineEdit</a>.

<h3 class=fn>bool <a name="eventFilter"></a>TQSpinBox::eventFilter ( <a href="qobject.html">TQObject</a>&nbsp;*&nbsp;o, <a href="qevent.html">TQEvent</a>&nbsp;*&nbsp;ev )<tt> [virtual protected]</tt>
</h3>
Intercepts and handles the events coming to the embedded <a href="qlineedit.html">TQLineEdit</a>
that have special meaning for the TQSpinBox. The object is passed
as <em>o</em> and the event is passed as <em>ev</em>.

<p>Reimplemented from <a href="qobject.html#eventFilter">TQObject</a>.
<h3 class=fn>void <a name="interpretText"></a>TQSpinBox::interpretText ()<tt> [virtual protected]</tt>
</h3>
TQSpinBox calls this after the user has manually edited the
contents of the spin box (i.e. by typing in the embedded
<a href="qlineedit.html">TQLineEdit</a>, rather than using the up/down buttons/keys).
<p> The default implementation of this function interprets the new
text using <a href="#mapTextToValue">mapTextToValue</a>(). If mapTextToValue() is successful, it
changes the spin box's value; if not, the value is left unchanged.
<p> <p>See also <a href="#editor">editor</a>().

<h3 class=fn>int <a name="lineStep"></a>TQSpinBox::lineStep () const
</h3><p>Returns the line step.
See the <a href="qspinbox.html#lineStep-prop">"lineStep"</a> property for details.
<h3 class=fn>int <a name="mapTextToValue"></a>TQSpinBox::mapTextToValue ( bool&nbsp;*&nbsp;ok )<tt> [virtual protected]</tt>
</h3>
This virtual function is used by the spin box whenever it needs to
interpret text entered by the user as a value. The text is
available as <a href="#text">text</a>() and as <a href="#cleanText">cleanText</a>(), and this function must
parse it if possible. If <em>ok</em> is not 0: if it parses the text
successfully, <em>*ok</em> is set to TRUE; otherwise <em>*ok</em> is set to
FALSE.
<p> Subclasses that need to display spin box values in a non-numeric
way need to reimplement this function.
<p> Note that TQt handles <a href="#specialValueText">specialValueText</a>() separately; this function
is only concerned with the other values.
<p> The default implementation tries to interpret the text() as an
integer in the standard way and returns the integer value.
<p> <p>See also <a href="#interpretText">interpretText</a>() and <a href="#mapValueToText">mapValueToText</a>().

<h3 class=fn><a href="qstring.html">TQString</a> <a name="mapValueToText"></a>TQSpinBox::mapValueToText ( int&nbsp;v )<tt> [virtual protected]</tt>
</h3>
This virtual function is used by the spin box whenever it needs to
display value <em>v</em>. The default implementation returns a string
containing <em>v</em> printed in the standard way. Reimplementations may
return anything. (See the example in the detailed description.)
<p> Note that TQt does not call this function for <a href="#specialValueText">specialValueText</a>()
and that neither <a href="#prefix">prefix</a>() nor <a href="#suffix">suffix</a>() are included in the return
value.
<p> If you reimplement this, you may also need to reimplement
<a href="#mapTextToValue">mapTextToValue</a>().
<p> <p>See also <a href="#updateDisplay">updateDisplay</a>() and <a href="#mapTextToValue">mapTextToValue</a>().

<h3 class=fn>int <a name="maxValue"></a>TQSpinBox::maxValue () const
</h3><p>Returns the maximum value of the spin box.
See the <a href="qspinbox.html#maxValue-prop">"maxValue"</a> property for details.
<h3 class=fn>int <a name="minValue"></a>TQSpinBox::minValue () const
</h3><p>Returns the minimum value of the spin box.
See the <a href="qspinbox.html#minValue-prop">"minValue"</a> property for details.
<h3 class=fn><a href="qstring.html">TQString</a> <a name="prefix"></a>TQSpinBox::prefix () const<tt> [virtual]</tt>
</h3><p>Returns the spin box's prefix.
See the <a href="qspinbox.html#prefix-prop">"prefix"</a> property for details.
<h3 class=fn>void <a name="rangeChange"></a>TQSpinBox::rangeChange ()<tt> [virtual protected]</tt>
</h3>
This virtual function is called by <a href="qrangecontrol.html">TQRangeControl</a> whenever the
range has changed. It adjusts the default validator and updates
the display; if you need additional processing, you can
reimplement this function.

<p>Reimplemented from <a href="qrangecontrol.html#rangeChange">TQRangeControl</a>.
<h3 class=fn>void <a name="selectAll"></a>TQSpinBox::selectAll ()<tt> [virtual slot]</tt>
</h3>
Selects all the text in the spin box's editor.

<h3 class=fn>void <a name="setButtonSymbols"></a>TQSpinBox::setButtonSymbols ( <a href="qspinbox.html#ButtonSymbols-enum">ButtonSymbols</a> )<tt> [virtual]</tt>
</h3><p>Sets the current button symbol mode.
See the <a href="qspinbox.html#buttonSymbols-prop">"buttonSymbols"</a> property for details.
<h3 class=fn>void <a name="setLineStep"></a>TQSpinBox::setLineStep ( int )
</h3><p>Sets the line step.
See the <a href="qspinbox.html#lineStep-prop">"lineStep"</a> property for details.
<h3 class=fn>void <a name="setMaxValue"></a>TQSpinBox::setMaxValue ( int )
</h3><p>Sets the maximum value of the spin box.
See the <a href="qspinbox.html#maxValue-prop">"maxValue"</a> property for details.
<h3 class=fn>void <a name="setMinValue"></a>TQSpinBox::setMinValue ( int )
</h3><p>Sets the minimum value of the spin box.
See the <a href="qspinbox.html#minValue-prop">"minValue"</a> property for details.
<h3 class=fn>void <a name="setPrefix"></a>TQSpinBox::setPrefix ( const&nbsp;<a href="qstring.html">TQString</a>&nbsp;&amp;&nbsp;text )<tt> [virtual slot]</tt>
</h3><p>Sets the spin box's prefix to <em>text</em>.
See the <a href="qspinbox.html#prefix-prop">"prefix"</a> property for details.
<h3 class=fn>void <a name="setSpecialValueText"></a>TQSpinBox::setSpecialValueText ( const&nbsp;<a href="qstring.html">TQString</a>&nbsp;&amp;&nbsp;text )<tt> [virtual]</tt>
</h3><p>Sets the special-value text to <em>text</em>.
See the <a href="qspinbox.html#specialValueText-prop">"specialValueText"</a> property for details.
<h3 class=fn>void <a name="setSuffix"></a>TQSpinBox::setSuffix ( const&nbsp;<a href="qstring.html">TQString</a>&nbsp;&amp;&nbsp;text )<tt> [virtual slot]</tt>
</h3><p>Sets the suffix of the spin box to <em>text</em>.
See the <a href="qspinbox.html#suffix-prop">"suffix"</a> property for details.
<h3 class=fn>void <a name="setValidator"></a>TQSpinBox::setValidator ( const&nbsp;<a href="qvalidator.html">TQValidator</a>&nbsp;*&nbsp;v )<tt> [virtual]</tt>
</h3>
Sets the validator to <em>v</em>. The validator controls what keyboard
input is accepted when the user is editing in the value field. The
default is to use a suitable <a href="qintvalidator.html">TQIntValidator</a>.
<p> Use <a href="#setValidator">setValidator</a>(0) to turn off input validation (entered input
will still be kept within the spin box's range).

<h3 class=fn>void <a name="setValue"></a>TQSpinBox::setValue ( int&nbsp;value )<tt> [virtual slot]</tt>
</h3><p>Sets the value of the spin box to <em>value</em>.
See the <a href="qspinbox.html#value-prop">"value"</a> property for details.
<h3 class=fn>void <a name="setWrapping"></a>TQSpinBox::setWrapping ( bool&nbsp;on )<tt> [virtual]</tt>
</h3><p>Sets whether it is possible to step the value from the highest value to the lowest value and vice versa to <em>on</em>.
See the <a href="qspinbox.html#wrapping-prop">"wrapping"</a> property for details.
<h3 class=fn><a href="qstring.html">TQString</a> <a name="specialValueText"></a>TQSpinBox::specialValueText () const
</h3><p>Returns the special-value text.
See the <a href="qspinbox.html#specialValueText-prop">"specialValueText"</a> property for details.
<h3 class=fn>void <a name="stepDown"></a>TQSpinBox::stepDown ()<tt> [virtual slot]</tt>
</h3>
Decreases the spin box's value one <a href="#lineStep">lineStep</a>(), wrapping as
necessary if <a href="#wrapping">wrapping</a>() is TRUE. This is the same as clicking on
the pointing-down button and can be used for keyboard
accelerators, for example.
<p> <p>See also <a href="#stepUp">stepUp</a>(), <a href="qrangecontrol.html#subtractLine">subtractLine</a>(), <a href="#lineStep-prop">lineStep</a>, <a href="qrangecontrol.html#setSteps">setSteps</a>(), <a href="#value-prop">value</a>, and <a href="#value-prop">value</a>.

<h3 class=fn>void <a name="stepUp"></a>TQSpinBox::stepUp ()<tt> [virtual slot]</tt>
</h3>
Increases the spin box's value by one <a href="#lineStep">lineStep</a>(), wrapping as
necessary if <a href="#wrapping">wrapping</a>() is TRUE. This is the same as clicking on
the pointing-up button and can be used for keyboard accelerators,
for example.
<p> <p>See also <a href="#stepDown">stepDown</a>(), <a href="qrangecontrol.html#addLine">addLine</a>(), <a href="#lineStep-prop">lineStep</a>, <a href="qrangecontrol.html#setSteps">setSteps</a>(), <a href="#value-prop">value</a>, and <a href="#value-prop">value</a>.

<h3 class=fn><a href="qstring.html">TQString</a> <a name="suffix"></a>TQSpinBox::suffix () const<tt> [virtual]</tt>
</h3><p>Returns the suffix of the spin box.
See the <a href="qspinbox.html#suffix-prop">"suffix"</a> property for details.
<h3 class=fn><a href="qstring.html">TQString</a> <a name="text"></a>TQSpinBox::text () const
</h3><p>Returns the spin box's text, including any <a href="#prefix">prefix</a>() and <a href="#suffix">suffix</a>().
See the <a href="qspinbox.html#text-prop">"text"</a> property for details.
<h3 class=fn>void <a name="textChanged"></a>TQSpinBox::textChanged ()<tt> [protected slot]</tt>
</h3>
This slot is called whenever the user edits the spin box's text.

<h3 class=fn><a href="qrect.html">TQRect</a> <a name="upRect"></a>TQSpinBox::upRect () const
</h3>
Returns the geometry of the "up" button.

<h3 class=fn>void <a name="updateDisplay"></a>TQSpinBox::updateDisplay ()<tt> [virtual protected]</tt>
</h3>
Updates the contents of the embedded <a href="qlineedit.html">TQLineEdit</a> to reflect the
current value using <a href="#mapValueToText">mapValueToText</a>(). Also enables/disables the
up/down push buttons accordingly.
<p> <p>See also <a href="#mapValueToText">mapValueToText</a>().

<h3 class=fn>const&nbsp;<a href="qvalidator.html">TQValidator</a>&nbsp;* <a name="validator"></a>TQSpinBox::validator () const
</h3>
Returns the validator that constrains editing for this spin box if
there is any; otherwise returns 0.
<p> <p>See also <a href="#setValidator">setValidator</a>() and <a href="qvalidator.html">TQValidator</a>.

<h3 class=fn>int <a name="value"></a>TQSpinBox::value () const
</h3><p>Returns the value of the spin box.
See the <a href="qspinbox.html#value-prop">"value"</a> property for details.
<h3 class=fn>void <a name="valueChange"></a>TQSpinBox::valueChange ()<tt> [virtual protected]</tt>
</h3>
This virtual function is called by <a href="qrangecontrol.html">TQRangeControl</a> whenever the
value has changed. The TQSpinBox reimplementation updates the
display and emits the <a href="#valueChanged">valueChanged</a>() signals; if you need
additional processing, either reimplement this or connect to one
of the valueChanged() signals.

<p>Reimplemented from <a href="qrangecontrol.html#valueChange">TQRangeControl</a>.
<h3 class=fn>void <a name="valueChanged"></a>TQSpinBox::valueChanged ( int&nbsp;value )<tt> [signal]</tt>
</h3>

<p> This signal is emitted every time the value of the spin box
changes; the new value is passed in <em>value</em>. This signal will be
emitted as a result of a call to <a href="#setValue">setValue</a>(), or because the user
changed the value by using a keyboard accelerator or mouse click,
etc.
<p> Note that the <a href="#valueChanged">valueChanged</a>() signal is emitted <em>every</em> time, not
just for the "last" step; i.e. if the user clicks "up" three
times, this signal is emitted three times.
<p> <p>See also <a href="#value-prop">value</a>.

<p>Examples: <a href="listbox-example.html#x1445">listbox/listbox.cpp</a>, <a href="qfd-example.html#x2009">qfd/fontdisplayer.cpp</a>, and <a href="scribble-example.html#x939">scribble/scribble.cpp</a>.
<h3 class=fn>void <a name="valueChanged-2"></a>TQSpinBox::valueChanged ( const&nbsp;<a href="qstring.html">TQString</a>&nbsp;&amp;&nbsp;valueText )<tt> [signal]</tt>
</h3>

<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This signal is emitted whenever the <a href="#valueChanged">valueChanged</a>( int ) signal is
emitted, i.e. every time the value of the spin box changes
(whatever the cause, e.g. by <a href="#setValue">setValue</a>(), by a keyboard
accelerator, by mouse clicks, etc.).
<p> The <em>valueText</em> parameter is the same string that is displayed in
the edit field of the spin box.
<p> <p>See also <a href="#value-prop">value</a>, <a href="#prefix-prop">prefix</a>, <a href="#suffix-prop">suffix</a>, and <a href="#specialValueText-prop">specialValueText</a>.

<h3 class=fn>bool <a name="wrapping"></a>TQSpinBox::wrapping () const
</h3><p>Returns TRUE if it is possible to step the value from the highest value to the lowest value and vice versa; otherwise returns FALSE.
See the <a href="qspinbox.html#wrapping-prop">"wrapping"</a> property for details.
<hr><h2>Property Documentation</h2>
<h3 class=fn><a href="qspinbox.html#ButtonSymbols-enum">ButtonSymbols</a> <a name="buttonSymbols-prop"></a>buttonSymbols</h3>
<p>This property holds the current button symbol mode.
<p>The possible values can be either <a href="#ButtonSymbols-enum">UpDownArrows</a> or <a href="#ButtonSymbols-enum">PlusMinus</a>.
The default is <a href="#ButtonSymbols-enum">UpDownArrows</a>.
<p> <p>See also <a href="#ButtonSymbols-enum">ButtonSymbols</a>.

<p>Set this property's value with <a href="#setButtonSymbols">setButtonSymbols</a>() and get this property's value with <a href="#buttonSymbols">buttonSymbols</a>().
<h3 class=fn><a href="qstring.html">TQString</a> <a name="cleanText-prop"></a>cleanText</h3>
<p>This property holds the spin box's text with no <a href="#prefix">prefix</a>(), <a href="#suffix">suffix</a>() or leading or trailing whitespace.
<p>Get this property's value with <a href="#cleanText">cleanText</a>().
<p><p>See also <a href="#text-prop">text</a>, <a href="#prefix-prop">prefix</a>, and <a href="#suffix-prop">suffix</a>.

<h3 class=fn>int <a name="lineStep-prop"></a>lineStep</h3>
<p>This property holds the line step.
<p>When the user uses the arrows to change the spin box's value the
value will be incremented/decremented by the amount of the line
step.
<p> The <a href="#setLineStep">setLineStep</a>() function calls the virtual <a href="qrangecontrol.html#stepChange">stepChange</a>() function
if the new line step is different from the previous setting.
<p> <p>See also <a href="qrangecontrol.html#setSteps">TQRangeControl::setSteps</a>() and <a href="qrangecontrol.html#setRange">setRange</a>().

<p>Set this property's value with <a href="#setLineStep">setLineStep</a>() and get this property's value with <a href="#lineStep">lineStep</a>().
<h3 class=fn>int <a name="maxValue-prop"></a>maxValue</h3>
<p>This property holds the maximum value of the spin box.
<p>When setting this property, <a href="#minValue-prop">TQSpinBox::minValue</a> is adjusted, if
necessary, to ensure that the range remains valid.
<p> <p>See also <a href="qrangecontrol.html#setRange">setRange</a>() and <a href="#specialValueText-prop">specialValueText</a>.

<p>Set this property's value with <a href="#setMaxValue">setMaxValue</a>() and get this property's value with <a href="#maxValue">maxValue</a>().
<h3 class=fn>int <a name="minValue-prop"></a>minValue</h3>
<p>This property holds the minimum value of the spin box.
<p>When setting this property, <a href="#maxValue-prop">TQSpinBox::maxValue</a> is adjusted, if
necessary, to ensure that the range remains valid.
<p> <p>See also <a href="qrangecontrol.html#setRange">setRange</a>() and <a href="#specialValueText-prop">specialValueText</a>.

<p>Set this property's value with <a href="#setMinValue">setMinValue</a>() and get this property's value with <a href="#minValue">minValue</a>().
<h3 class=fn><a href="qstring.html">TQString</a> <a name="prefix-prop"></a>prefix</h3>
<p>This property holds the spin box's prefix.
<p>The prefix is prepended to the start of the displayed value.
Typical use is to display a unit of measurement or a currency
symbol. For example:
<p> <pre>
        sb-&gt;setPrefix( "$" );
    </pre>
 
<p> To turn off the prefix display, set this property to an empty
string. The default is no prefix. The prefix is not displayed for
the <a href="#minValue">minValue</a>() if <a href="#specialValueText">specialValueText</a>() is not empty.
<p> If no prefix is set, <a href="#prefix">prefix</a>() returns <a href="qstring.html#TQString-null">TQString::null</a>.
<p> <p>See also <a href="#suffix-prop">suffix</a>.

<p>Set this property's value with <a href="#setPrefix">setPrefix</a>() and get this property's value with <a href="#prefix">prefix</a>().
<h3 class=fn><a href="qstring.html">TQString</a> <a name="specialValueText-prop"></a>specialValueText</h3>
<p>This property holds the special-value text.
<p>If set, the spin box will display this text instead of a numeric
value whenever the current value is equal to minVal(). Typical use
is to indicate that this choice has a special (default) meaning.
<p> For example, if your spin box allows the user to choose the margin
width in a print dialog and your application is able to
automatically choose a good margin width, you can set up the spin
box like this:
<pre>
        TQSpinBox marginBox( -1, 20, 1, parent, "marginBox" );
        marginBox-&gt;<a href="#setSuffix">setSuffix</a>( " mm" );
        marginBox-&gt;<a href="#setSpecialValueText">setSpecialValueText</a>( "Auto" );
    </pre>
 
The user will then be able to choose a margin width from 0-20
millimeters or select "Auto" to leave it to the application to
choose. Your code must then interpret the spin box value of -1 as
the user requesting automatic margin width.
<p> All values are displayed with the <a href="#prefix">prefix</a>() and <a href="#suffix">suffix</a>() (if set),
<em>except</em> for the special value, which only shows the special
value text.
<p> To turn off the special-value text display, call this function
with an empty string. The default is no special-value text, i.e.
the numeric value is shown as usual.
<p> If no special-value text is set, <a href="#specialValueText">specialValueText</a>() returns
<a href="qstring.html#TQString-null">TQString::null</a>.

<p>Set this property's value with <a href="#setSpecialValueText">setSpecialValueText</a>() and get this property's value with <a href="#specialValueText">specialValueText</a>().
<h3 class=fn><a href="qstring.html">TQString</a> <a name="suffix-prop"></a>suffix</h3>
<p>This property holds the suffix of the spin box.
<p>The suffix is appended to the end of the displayed value. Typical
use is to display a unit of measurement or a currency symbol. For
example:
<p> <pre>
        sb-&gt;setSuffix( " km" );
    </pre>
 
<p> To turn off the suffix display, set this property to an empty
string. The default is no suffix. The suffix is not displayed for
the <a href="#minValue">minValue</a>() if <a href="#specialValueText">specialValueText</a>() is not empty.
<p> If no suffix is set, <a href="#suffix">suffix</a>() returns a <a href="qstring.html#TQString-null">TQString::null</a>.
<p> <p>See also <a href="#prefix-prop">prefix</a>.

<p>Set this property's value with <a href="#setSuffix">setSuffix</a>() and get this property's value with <a href="#suffix">suffix</a>().
<h3 class=fn><a href="qstring.html">TQString</a> <a name="text-prop"></a>text</h3>
<p>This property holds the spin box's text, including any <a href="#prefix">prefix</a>() and <a href="#suffix">suffix</a>().
<p>There is no default text.
<p> <p>See also <a href="#value-prop">value</a>.

<p>Get this property's value with <a href="#text">text</a>().
<h3 class=fn>int <a name="value-prop"></a>value</h3>
<p>This property holds the value of the spin box.
<p>Set this property's value with <a href="#setValue">setValue</a>() and get this property's value with <a href="#value">value</a>().
<p><p>See also <a href="qrangecontrol.html#setValue">TQRangeControl::setValue</a>().

<h3 class=fn>bool <a name="wrapping-prop"></a>wrapping</h3>
<p>This property holds whether it is possible to step the value from the highest value to the lowest value and vice versa.
<p>By default, wrapping is turned off.
<p> If you have a range of 0..100 and wrapping is off when the user
reaches 100 and presses the Up Arrow nothing will happen; but if
wrapping is on the value will change from 100 to 0, then to 1,
etc. When wrapping is on, navigating past the highest value takes
you to the lowest and vice versa.
<p> <p>See also <a href="#minValue-prop">minValue</a>, <a href="#maxValue-prop">maxValue</a>, and <a href="qrangecontrol.html#setRange">setRange</a>().

<p>Set this property's value with <a href="#setWrapping">setWrapping</a>() and get this property's value with <a href="#wrapping">wrapping</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<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 &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>