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
|
'\" t
.TH TQRangeControl 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
TQRangeControl \- Integer value within a range
.SH SYNOPSIS
\fC#include <tqrangecontrol.h>\fR
.PP
Inherited by TQDial, TQScrollBar, TQSlider, and TQSpinBox.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBTQRangeControl\fR ()"
.br
.ti -1c
.BI "\fBTQRangeControl\fR ( int minValue, int maxValue, int lineStep, int pageStep, int value )"
.br
.ti -1c
.BI "virtual \fB~TQRangeControl\fR ()"
.br
.ti -1c
.BI "int \fBvalue\fR () const"
.br
.ti -1c
.BI "void \fBsetValue\fR ( int value )"
.br
.ti -1c
.BI "void \fBaddPage\fR ()"
.br
.ti -1c
.BI "void \fBsubtractPage\fR ()"
.br
.ti -1c
.BI "void \fBaddLine\fR ()"
.br
.ti -1c
.BI "void \fBsubtractLine\fR ()"
.br
.ti -1c
.BI "int \fBminValue\fR () const"
.br
.ti -1c
.BI "int \fBmaxValue\fR () const"
.br
.ti -1c
.BI "void \fBsetRange\fR ( int minValue, int maxValue )"
.br
.ti -1c
.BI "void \fBsetMinValue\fR ( int minVal )"
.br
.ti -1c
.BI "void \fBsetMaxValue\fR ( int maxVal )"
.br
.ti -1c
.BI "int \fBlineStep\fR () const"
.br
.ti -1c
.BI "int \fBpageStep\fR () const"
.br
.ti -1c
.BI "void \fBsetSteps\fR ( int lineStep, int pageStep )"
.br
.ti -1c
.BI "int \fBbound\fR ( int v ) const"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "int \fBpositionFromValue\fR ( int logical_val, int span ) const"
.br
.ti -1c
.BI "int \fBvalueFromPosition\fR ( int pos, int span ) const"
.br
.ti -1c
.BI "void \fBdirectSetValue\fR ( int value )"
.br
.ti -1c
.BI "int \fBprevValue\fR () const"
.br
.ti -1c
.BI "virtual void \fBvalueChange\fR ()"
.br
.ti -1c
.BI "virtual void \fBrangeChange\fR ()"
.br
.ti -1c
.BI "virtual void \fBstepChange\fR ()"
.br
.in -1c
.SH DESCRIPTION
The TQRangeControl class provides an integer value within a range.
.PP
Although originally designed for the TQScrollBar widget, the TQRangeControl can also be used in conjunction with other widgets such as TQSlider and TQSpinBox. Here are the five main concepts in the class:
.PP
<ol type=1>
.IP 1
\fICurrent value\fR The bounded integer that TQRangeControl maintains. value() returns it, and several functions, including setValue(), set it.
.IP 2
\fIMinimum\fR The lowest value that value() can ever return. Returned by minValue() and set by setRange() or one of the constructors.
.IP 3
\fIMaximum\fR The highest value that value() can ever return. Returned by maxValue() and set by setRange() or one of the constructors.
.IP 4
\fILine step\fR The smaller of two natural steps that TQRangeControl provides and typically corresponds to the user pressing an arrow key. The line step is returned by lineStep() and set using setSteps(). The functions addLine() and subtractLine() respectively increment and decrement the current value by lineStep().
.IP 5
\fIPage step\fR The larger of two natural steps that TQRangeControl provides and typically corresponds to the user pressing PageUp or PageDown. The page step is returned by pageStep() and set using setSteps(). The functions addPage() and substractPage() respectively increment and decrement the current value by pageStep().
.IP
.PP
Unity (1) may be viewed as a third step size. setValue() lets you set the current value to any integer in the allowed range, not just minValue() + \fIn\fR * lineStep() for integer values of \fIn\fR. Some widgets may allow the user to set any value at all; others may just provide multiples of lineStep() or pageStep().
.PP
TQRangeControl provides three virtual functions that are well suited for updating the on-screen representation of range controls and emitting signals: valueChange(), rangeChange() and stepChange().
.PP
TQRangeControl also provides a function called bound() which lets you force arbitrary integers to be within the allowed range of the range control.
.PP
We recommend that all widgets that inherit TQRangeControl provide at least a signal called valueChanged(); many widgets will want to provide addStep(), addPage(), substractStep() and substractPage() as slots.
.PP
Note that you must use multiple inheritance if you plan to implement a widget using TQRangeControl because TQRangeControl is not derived from TQWidget.
.PP
See also Miscellaneous Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQRangeControl::TQRangeControl ()"
Constructs a range control with a minimum value of 0, maximum value of 99, line step of 1, page step of 10 and initial value 0.
.SH "TQRangeControl::TQRangeControl ( int minValue, int maxValue, int lineStep, int pageStep, int value )"
Constructs a range control whose value can never be smaller than \fIminValue\fR or greater than \fImaxValue\fR, whose line step size is \fIlineStep\fR and page step size is \fIpageStep\fR and whose value is initially \fIvalue\fR (which is guaranteed to be in range using bound()).
.SH "TQRangeControl::~TQRangeControl ()\fC [virtual]\fR"
Destroys the range control
.SH "void TQRangeControl::addLine ()"
Equivalent to \fCsetValue( value() + lineStep() )\fR.
.PP
If the value is changed, then valueChange() is called.
.PP
See also subtractLine(), addPage(), and setValue().
.SH "void TQRangeControl::addPage ()"
Equivalent to \fCsetValue( value() + pageStep() )\fR.
.PP
If the value is changed, then valueChange() is called.
.PP
See also subtractPage(), addLine(), and setValue().
.SH "int TQRangeControl::bound ( int v ) const"
Forces the value \fIv\fR to be within the range from minValue() to maxValue() inclusive, and returns the result.
.PP
This function is provided so that you can easily force other numbers than value() into the allowed range. You do not need to call it in order to use TQRangeControl itself.
.PP
See also setValue(), value(), minValue(), and maxValue().
.SH "void TQRangeControl::directSetValue ( int value )\fC [protected]\fR"
Sets the range control \fIvalue\fR directly without calling valueChange().
.PP
Forces the new \fIvalue\fR to be within the legal range.
.PP
You will rarely have to call this function. However, if you want to change the range control's value inside the overloaded method valueChange(), setValue() would call the function valueChange() again. To avoid this recursion you must use directSetValue() instead.
.PP
See also setValue().
.SH "int TQRangeControl::lineStep () const"
Returns the line step.
.PP
See also setSteps() and pageStep().
.SH "int TQRangeControl::maxValue () const"
Returns the maximum value of the range.
.PP
See also setMaxValue(), setRange(), and minValue().
.SH "int TQRangeControl::minValue () const"
Returns the minimum value of the range.
.PP
See also setMinValue(), setRange(), and maxValue().
.SH "int TQRangeControl::pageStep () const"
Returns the page step.
.PP
See also setSteps() and lineStep().
.SH "int TQRangeControl::positionFromValue ( int logical_val, int span ) const\fC [protected]\fR"
Converts \fIlogical_val\fR to a pixel position. minValue() maps to 0, maxValue() maps to \fIspan\fR and other values are distributed evenly in-between.
.PP
This function can handle the entire integer range without overflow, providing \fIspan\fR is <= 4096.
.PP
Calling this method is useful when actually drawing a range control such as a TQScrollBar on-screen.
.PP
See also valueFromPosition().
.SH "int TQRangeControl::prevValue () const\fC [protected]\fR"
Returns the previous value of the range control. "Previous value" means the value before the last change occurred. Setting a new range may affect the value, too, because the value is forced to be inside the specified range. When the range control is initially created, this is the same as value().
.PP
prevValue() can be outside the current legal range if a call to setRange() causes the current value to change. For example, if the range was [0, 1000] and the current value is 500, setRange(0, 400) makes value() return 400 and prevValue() return 500.
.PP
See also value() and setRange().
.SH "void TQRangeControl::rangeChange ()\fC [virtual protected]\fR"
This virtual function is called whenever the range control's range changes. You can reimplement it if you want to be notified when the range changes. The default implementation does nothing.
.PP
Note that this method is called after the range has changed.
.PP
See also setRange(), valueChange(), and stepChange().
.PP
Reimplemented in TQDial, TQSlider, and TQSpinBox.
.SH "void TQRangeControl::setMaxValue ( int maxVal )"
Sets the minimum value of the range to \fImaxVal\fR.
.PP
If necessary, the minValue() is adjusted so that the range remains valid.
.PP
See also maxValue() and setMinValue().
.SH "void TQRangeControl::setMinValue ( int minVal )"
Sets the minimum value of the range to \fIminVal\fR.
.PP
If necessary, the maxValue() is adjusted so that the range remains valid.
.PP
See also minValue() and setMaxValue().
.SH "void TQRangeControl::setRange ( int minValue, int maxValue )"
Sets the range control's minimum value to \fIminValue\fR and its maximum value to \fImaxValue\fR.
.PP
Calls the virtual rangeChange() function if one or both of the new minimum and maximum values are different from the previous setting. Calls the virtual valueChange() function if the current value is adjusted because it was outside the new range.
.PP
If \fImaxValue\fR is smaller than \fIminValue\fR, \fIminValue\fR becomes the only legal value.
.PP
See also minValue() and maxValue().
.PP
Examples:
.)l listbox/listbox.cpp, t12/lcdrange.cpp, t5/main.cpp, t6/main.cpp, t8/lcdrange.cpp, and xform/xform.cpp.
.SH "void TQRangeControl::setSteps ( int lineStep, int pageStep )"
Sets the range's line step to \fIlineStep\fR and page step to \fIpageStep\fR.
.PP
Calls the virtual stepChange() function if the new line step or page step are different from the previous settings.
.PP
See also lineStep(), pageStep(), and setRange().
.SH "void TQRangeControl::setValue ( int value )"
Sets the range control's value to \fIvalue\fR and forces it to be within the legal range.
.PP
Calls the virtual valueChange() function if the new value is different from the previous value. The old value can still be retrieved using prevValue().
.PP
See also value().
.SH "void TQRangeControl::stepChange ()\fC [virtual protected]\fR"
This virtual function is called whenever the range control's line or page step settings change. You can reimplement it if you want to be notified when the step changes. The default implementation does nothing.
.PP
Note that this method is called after a step setting has changed.
.PP
See also setSteps(), rangeChange(), and valueChange().
.SH "void TQRangeControl::subtractLine ()"
Equivalent to \fCsetValue( value() - lineStep() )\fR.
.PP
If the value is changed, then valueChange() is called.
.PP
See also addLine(), subtractPage(), and setValue().
.SH "void TQRangeControl::subtractPage ()"
Equivalent to \fCsetValue( value() - pageStep() )\fR.
.PP
If the value is changed, then valueChange() is called.
.PP
See also addPage(), subtractLine(), and setValue().
.SH "int TQRangeControl::value () const"
Returns the current range control value. This is guaranteed to be within the range [minValue(), maxValue()].
.PP
See also setValue() and prevValue().
.SH "void TQRangeControl::valueChange ()\fC [virtual protected]\fR"
This virtual function is called whenever the range control value changes. You can reimplement it if you want to be notified when the value changes. The default implementation does nothing.
.PP
Note that this method is called after the value has changed. The previous value can be retrieved using prevValue().
.PP
See also setValue(), addPage(), subtractPage(), addLine(), subtractLine(), rangeChange(), and stepChange().
.PP
Reimplemented in TQDial, TQSlider, and TQSpinBox.
.SH "int TQRangeControl::valueFromPosition ( int pos, int span ) const\fC [protected]\fR"
Converts the pixel position \fIpos\fR to a value. 0 maps to minValue(), \fIspan\fR maps to maxValue() and other values are distributed evenly in-between.
.PP
This function can handle the entire integer range without overflow.
.PP
Calling this method is useful if you actually implemented a range control widget such as TQScrollBar and want to handle mouse press events. This function then maps screen coordinates to the logical values.
.PP
See also positionFromValue().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqrangecontrol.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 TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt 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 (tqrangecontrol.3qt) and the Qt
version (3.3.8).
|