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
|
'\" t
.TH QScrollBar 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
QScrollBar \- Vertical or horizontal scroll bar
.SH SYNOPSIS
\fC#include <qscrollbar.h>\fR
.PP
Inherits QWidget and QRangeControl.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQScrollBar\fR ( QWidget * parent, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQScrollBar\fR ( Orientation orientation, QWidget * parent, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQScrollBar\fR ( int minValue, int maxValue, int lineStep, int pageStep, int value, Orientation orientation, QWidget * parent, const char * name = 0 )"
.br
.ti -1c
.BI "\fB~QScrollBar\fR ()"
.br
.ti -1c
.BI "virtual void \fBsetOrientation\fR ( Orientation )"
.br
.ti -1c
.BI "Orientation \fBorientation\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetTracking\fR ( bool enable )"
.br
.ti -1c
.BI "bool \fBtracking\fR () const"
.br
.ti -1c
.BI "bool \fBdraggingSlider\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetPalette\fR ( const QPalette & p )"
.br
.ti -1c
.BI "int \fBminValue\fR () const"
.br
.ti -1c
.BI "int \fBmaxValue\fR () const"
.br
.ti -1c
.BI "void \fBsetMinValue\fR ( int )"
.br
.ti -1c
.BI "void \fBsetMaxValue\fR ( int )"
.br
.ti -1c
.BI "int \fBlineStep\fR () const"
.br
.ti -1c
.BI "int \fBpageStep\fR () const"
.br
.ti -1c
.BI "void \fBsetLineStep\fR ( int )"
.br
.ti -1c
.BI "void \fBsetPageStep\fR ( int )"
.br
.ti -1c
.BI "int \fBvalue\fR () const"
.br
.ti -1c
.BI "int \fBsliderStart\fR () const"
.br
.ti -1c
.BI "QRect \fBsliderRect\fR () const"
.br
.in -1c
.SS "Public Slots"
.in +1c
.ti -1c
.BI "void \fBsetValue\fR ( int )"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBvalueChanged\fR ( int value )"
.br
.ti -1c
.BI "void \fBsliderPressed\fR ()"
.br
.ti -1c
.BI "void \fBsliderMoved\fR ( int value )"
.br
.ti -1c
.BI "void \fBsliderReleased\fR ()"
.br
.ti -1c
.BI "void \fBnextLine\fR ()"
.br
.ti -1c
.BI "void \fBprevLine\fR ()"
.br
.ti -1c
.BI "void \fBnextPage\fR ()"
.br
.ti -1c
.BI "void \fBprevPage\fR ()"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "bool \fBdraggingSlider\fR - whether the user has clicked the mouse on the slider and is currently dragging it \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "int \fBlineStep\fR - the line step"
.br
.ti -1c
.BI "int \fBmaxValue\fR - the scroll bar's maximum value"
.br
.ti -1c
.BI "int \fBminValue\fR - the scroll bar's minimum value"
.br
.ti -1c
.BI "Orientation \fBorientation\fR - the orientation of the scroll bar"
.br
.ti -1c
.BI "int \fBpageStep\fR - the page step"
.br
.ti -1c
.BI "bool \fBtracking\fR - whether scroll bar tracking is enabled"
.br
.ti -1c
.BI "int \fBvalue\fR - the scroll bar's value"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "virtual void \fBhideEvent\fR ( QHideEvent * )"
.br
.in -1c
.SH DESCRIPTION
The QScrollBar widget provides a vertical or horizontal scroll bar.
.PP
A scroll bar allows the user to control a value within a program-definable range and gives users a visible indication of the current value of a range control.
.PP
Scroll bars include four separate controls:
.IP
.TP
The \fIline-up\fR and \fIline-down\fR controls are little buttons which the user can use to move one "line" up or down. The meaning of line is configurable. In editors and list boxes it means one line of text; in an image viewer it might mean 20 pixels.
.IP
.TP
The \fIslider\fR is the handle that indicates the current value of the scroll bar, which the user can drag to change the value. This part of the scroll bar is sometimes called the "thumb".
.IP
.TP
The \fIpage-up/page-down\fR control is the area on which the slider slides (the scroll bar's background). Clicking here moves the scroll bar towards the click. The meaning of "page" is also configurable: in editors and list boxes it means as many lines as there is space for in the widget.
.IP
.PP
QScrollBar has very few of its own functions; it mostly relies on QRangeControl. The most useful functions are setValue() to set the scroll bar directly to some value; addPage(), addLine(), subtractPage(), and subtractLine() to simulate the effects of clicking (useful for accelerator keys); setSteps() to define the values of pageStep() and lineStep(); and setRange() to set the minValue() and maxValue() of the scroll bar. QScrollBar has a convenience constructor with which you can set most of these properties.
.PP
Some GUI styles (for example, the Windows and Motif styles provided with Qt), also use the pageStep() value to calculate the size of the slider.
.PP
In addition to the access functions from QRangeControl, QScrollBar provides a comprehensive set of signals: <center>.nf
.TS
l - l. Signal Emitted when valueChanged() the scroll bar's value has changed. The tracking() determines whether this signal is emitted during user interaction. sliderPressed() the user starts to drag the slider. sliderMoved() the user drags the slider. sliderReleased() the user releases the slider. nextLine() the scroll bar has moved one line down or right. Line is defined in QRangeControl. prevLine() the scroll bar has moved one line up or left. nextPage() the scroll bar has moved one page down or right. prevPage()
.TE
.fi
</center>
.PP
QScrollBar only provides integer ranges. Note that although QScrollBar handles very large numbers, scroll bars on current screens cannot usefully control ranges above about 100,000 pixels. Beyond that, it becomes difficult for the user to control the scroll bar using either the keyboard or the mouse.
.PP
A scroll bar can be controlled by the keyboard, but it has a default focusPolicy() of NoFocus. Use setFocusPolicy() to enable keyboard focus. See keyPressEvent() for a list of key bindings.
.PP
If you need to add scroll bars to an interface, consider using the QScrollView class, which encapsulates the common uses for scroll bars.
.PP
.ce 1
.B "[Image Omitted]"
.PP
.ce 1
.B "[Image Omitted]"
.PP
See also QSlider, QSpinBox, QScrollView, GUI Design Handbook: Scroll Bar, and Basic Widgets.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QScrollBar::QScrollBar ( QWidget * parent, const char * name = 0 )"
Constructs a vertical scroll bar.
.PP
The \fIparent\fR and \fIname\fR arguments are sent on to the QWidget constructor.
.PP
The minValue defaults to 0, the maxValue to 99, with a lineStep size of 1 and a pageStep size of 10, and an initial value of 0.
.SH "QScrollBar::QScrollBar ( Orientation orientation, QWidget * parent, const char * name = 0 )"
Constructs a scroll bar.
.PP
The \fIorientation\fR must be Qt::Vertical or Qt::Horizontal.
.PP
The \fIparent\fR and \fIname\fR arguments are sent on to the QWidget constructor.
.PP
The minValue defaults to 0, the maxValue to 99, with a lineStep size of 1 and a pageStep size of 10, and an initial value of 0.
.SH "QScrollBar::QScrollBar ( int minValue, int maxValue, int lineStep, int pageStep, int value, Orientation orientation, QWidget * parent, const char * name = 0 )"
Constructs a scroll bar 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()).
.PP
If \fIorientation\fR is Vertical the scroll bar is vertical and if it is Horizontal the scroll bar is horizontal.
.PP
The \fIparent\fR and \fIname\fR arguments are sent on to the QWidget constructor.
.SH "QScrollBar::~QScrollBar ()"
Destructor.
.SH "bool QScrollBar::draggingSlider () const"
Returns TRUE if the user has clicked the mouse on the slider and is currently dragging it; otherwise returns FALSE. See the "draggingSlider" property for details.
.SH "void QScrollBar::hideEvent ( QHideEvent * )\fC [virtual protected]\fR"
This function is called when the scrollbar is hidden.
.PP
Reimplemented from QWidget.
.SH "int QScrollBar::lineStep () const"
Returns the line step. See the "lineStep" property for details.
.SH "int QScrollBar::maxValue () const"
Returns the scroll bar's maximum value. See the "maxValue" property for details.
.SH "int QScrollBar::minValue () const"
Returns the scroll bar's minimum value. See the "minValue" property for details.
.SH "void QScrollBar::nextLine ()\fC [signal]\fR"
This signal is emitted when the scroll bar scrolls one line down or right.
.SH "void QScrollBar::nextPage ()\fC [signal]\fR"
This signal is emitted when the scroll bar scrolls one page down or right.
.SH "Orientation QScrollBar::orientation () const"
Returns the orientation of the scroll bar. See the "orientation" property for details.
.SH "int QScrollBar::pageStep () const"
Returns the page step. See the "pageStep" property for details.
.SH "void QScrollBar::prevLine ()\fC [signal]\fR"
This signal is emitted when the scroll bar scrolls one line up or left.
.SH "void QScrollBar::prevPage ()\fC [signal]\fR"
This signal is emitted when the scroll bar scrolls one page up or left.
.SH "void QScrollBar::setLineStep ( int )"
Sets the line step. See the "lineStep" property for details.
.SH "void QScrollBar::setMaxValue ( int )"
Sets the scroll bar's maximum value. See the "maxValue" property for details.
.SH "void QScrollBar::setMinValue ( int )"
Sets the scroll bar's minimum value. See the "minValue" property for details.
.SH "void QScrollBar::setOrientation ( Orientation )\fC [virtual]\fR"
Sets the orientation of the scroll bar. See the "orientation" property for details.
.SH "void QScrollBar::setPageStep ( int )"
Sets the page step. See the "pageStep" property for details.
.SH "void QScrollBar::setPalette ( const QPalette & p )\fC [virtual]\fR"
Reimplements the virtual function QWidget::setPalette().
.PP
Sets the background color to the mid color for Motif style scroll bars using palette \fIp\fR.
.PP
Reimplemented from QWidget.
.SH "void QScrollBar::setTracking ( bool enable )\fC [virtual]\fR"
Sets whether scroll bar tracking is enabled to \fIenable\fR. See the "tracking" property for details.
.SH "void QScrollBar::setValue ( int )\fC [slot]\fR"
Sets the scroll bar's value. See the "value" property for details.
.SH "void QScrollBar::sliderMoved ( int value )\fC [signal]\fR"
This signal is emitted when the slider is dragged by the user, with the new scroll bar \fIvalue\fR as an argument.
.PP
This signal is emitted even when tracking is turned off.
.PP
See also tracking, valueChanged(), nextLine(), prevLine(), nextPage(), and prevPage().
.SH "void QScrollBar::sliderPressed ()\fC [signal]\fR"
This signal is emitted when the user presses the slider with the mouse.
.SH "QRect QScrollBar::sliderRect () const"
Returns the scroll bar slider rectangle.
.PP
See also sliderStart().
.SH "void QScrollBar::sliderReleased ()\fC [signal]\fR"
This signal is emitted when the user releases the slider with the mouse.
.SH "int QScrollBar::sliderStart () const"
Returns the pixel position where the scroll bar slider starts.
.PP
This is equivalent to sliderRect().y() for vertical scroll bars or sliderRect().x() for horizontal scroll bars.
.SH "bool QScrollBar::tracking () const"
Returns TRUE if scroll bar tracking is enabled; otherwise returns FALSE. See the "tracking" property for details.
.SH "int QScrollBar::value () const"
Returns the scroll bar's value. See the "value" property for details.
.SH "void QScrollBar::valueChanged ( int value )\fC [signal]\fR"
This signal is emitted when the scroll bar value has changed, with the new scroll bar \fIvalue\fR as an argument.
.SS "Property Documentation"
.SH "bool draggingSlider"
This property holds whether the user has clicked the mouse on the slider and is currently dragging it.
.PP
Get this property's value with draggingSlider().
.SH "int lineStep"
This property holds the line step.
.PP
When setting lineStep, the virtual stepChange() function will be called if the new line step is different from the previous setting.
.PP
See also setSteps(), QRangeControl::pageStep(), and setRange().
.PP
Set this property's value with setLineStep() and get this property's value with lineStep().
.SH "int maxValue"
This property holds the scroll bar's maximum value.
.PP
When setting this property, the QScrollBar::minValue is adjusted if necessary to ensure that the range remains valid.
.PP
See also setRange().
.PP
Set this property's value with setMaxValue() and get this property's value with maxValue().
.SH "int minValue"
This property holds the scroll bar's minimum value.
.PP
When setting this property, the QScrollBar::maxValue is adjusted if necessary to ensure that the range remains valid.
.PP
See also setRange().
.PP
Set this property's value with setMinValue() and get this property's value with minValue().
.SH "Orientation orientation"
This property holds the orientation of the scroll bar.
.PP
The orientation must be Qt::Vertical (the default) or Qt::Horizontal.
.PP
Set this property's value with setOrientation() and get this property's value with orientation().
.SH "int pageStep"
This property holds the page step.
.PP
When setting pageStep, the virtual stepChange() function will be called if the new page step is different from the previous setting.
.PP
See also QRangeControl::setSteps(), lineStep, and setRange().
.PP
Set this property's value with setPageStep() and get this property's value with pageStep().
.SH "bool tracking"
This property holds whether scroll bar tracking is enabled.
.PP
If tracking is enabled (the default), the scroll bar emits the valueChanged() signal while the slider is being dragged. If tracking is disabled, the scroll bar emits the valueChanged() signal only when the user releases the mouse button after moving the slider.
.PP
Set this property's value with setTracking() and get this property's value with tracking().
.SH "int value"
This property holds the scroll bar's value.
.PP
Set this property's value with setValue() and get this property's value with value().
.PP
See also QRangeControl::value() and prevValue().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qscrollbar.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 qt-bugs@trolltech.com .
Please include the name of the manual page (qscrollbar.3qt) and the Qt
version (3.3.8).
|