1QScrollBar(3qt) QScrollBar(3qt)
2
3
4
6 QScrollBar - Vertical or horizontal scroll bar
7
9 #include <qscrollbar.h>
10
11 Inherits QWidget and QRangeControl.
12
13 Public Members
14 QScrollBar ( QWidget * parent, const char * name = 0 )
15 QScrollBar ( Orientation orientation, QWidget * parent, const char *
16 name = 0 )
17 QScrollBar ( int minValue, int maxValue, int lineStep, int pageStep,
18 int value, Orientation orientation, QWidget * parent, const char *
19 name = 0 )
20 ~QScrollBar ()
21 virtual void setOrientation ( Orientation )
22 Orientation orientation () const
23 virtual void setTracking ( bool enable )
24 bool tracking () const
25 bool draggingSlider () const
26 virtual void setPalette ( const QPalette & p )
27 int minValue () const
28 int maxValue () const
29 void setMinValue ( int )
30 void setMaxValue ( int )
31 int lineStep () const
32 int pageStep () const
33 void setLineStep ( int )
34 void setPageStep ( int )
35 int value () const
36 int sliderStart () const
37 QRect sliderRect () const
38
39 Public Slots
40 void setValue ( int )
41
42 Signals
43 void valueChanged ( int value )
44 void sliderPressed ()
45 void sliderMoved ( int value )
46 void sliderReleased ()
47 void nextLine ()
48 void prevLine ()
49 void nextPage ()
50 void prevPage ()
51
52 Properties
53 bool draggingSlider - whether the user has clicked the mouse on the
54 slider and is currently dragging it (read only)
55 int lineStep - the line step
56 int maxValue - the scroll bar's maximum value
57 int minValue - the scroll bar's minimum value
58 Orientation orientation - the orientation of the scroll bar
59 int pageStep - the page step
60 bool tracking - whether scroll bar tracking is enabled
61 int value - the scroll bar's value
62
63 Protected Members
64 virtual void hideEvent ( QHideEvent * )
65
67 The QScrollBar widget provides a vertical or horizontal scroll bar.
68
69 A scroll bar allows the user to control a value within a program-
70 definable range and gives users a visible indication of the current
71 value of a range control.
72
73 Scroll bars include four separate controls:
74
75 The line-up and line-down controls are little buttons which the user
76 can use to move one "line" up or down. The meaning of line is
77 configurable. In editors and list boxes it means one line of text; in
78 an image viewer it might mean 20 pixels.
79
80 The slider is the handle that indicates the current value of the scroll
81 bar, which the user can drag to change the value. This part of the
82 scroll bar is sometimes called the "thumb".
83
84 The page-up/page-down control is the area on which the slider slides
85 (the scroll bar's background). Clicking here moves the scroll bar
86 towards the click. The meaning of "page" is also configurable: in
87 editors and list boxes it means as many lines as there is space for in
88 the widget.
89
90 QScrollBar has very few of its own functions; it mostly relies on
91 QRangeControl. The most useful functions are setValue() to set the
92 scroll bar directly to some value; addPage(), addLine(),
93 subtractPage(), and subtractLine() to simulate the effects of clicking
94 (useful for accelerator keys); setSteps() to define the values of
95 pageStep() and lineStep(); and setRange() to set the minValue() and
96 maxValue() of the scroll bar. QScrollBar has a convenience constructor
97 with which you can set most of these properties.
98
99 Some GUI styles (for example, the Windows and Motif styles provided
100 with Qt), also use the pageStep() value to calculate the size of the
101 slider.
102
103 In addition to the access functions from QRangeControl, QScrollBar
104 provides a comprehensive set of signals: <center>.nf
105
106 </center>
107
108 QScrollBar only provides integer ranges. Note that although QScrollBar
109 handles very large numbers, scroll bars on current screens cannot
110 usefully control ranges above about 100,000 pixels. Beyond that, it
111 becomes difficult for the user to control the scroll bar using either
112 the keyboard or the mouse.
113
114 A scroll bar can be controlled by the keyboard, but it has a default
115 focusPolicy() of NoFocus. Use setFocusPolicy() to enable keyboard
116 focus. See keyPressEvent() for a list of key bindings.
117
118 If you need to add scroll bars to an interface, consider using the
119 QScrollView class, which encapsulates the common uses for scroll bars.
120
121 [Image Omitted]
122
123 [Image Omitted]
124
125 See also QSlider, QSpinBox, QScrollView, GUI Design Handbook: Scroll
126 Bar, and Basic Widgets.
127
130 Constructs a vertical scroll bar.
131
132 The parent and name arguments are sent on to the QWidget constructor.
133
134 The minValue defaults to 0, the maxValue to 99, with a lineStep size of
135 1 and a pageStep size of 10, and an initial value of 0.
136
138 * name = 0 )
139 Constructs a scroll bar.
140
141 The orientation must be Qt::Vertical or Qt::Horizontal.
142
143 The parent and name arguments are sent on to the QWidget constructor.
144
145 The minValue defaults to 0, the maxValue to 99, with a lineStep size of
146 1 and a pageStep size of 10, and an initial value of 0.
147
149 pageStep, int value, Orientation orientation, QWidget * parent, const
150 char * name = 0 )
151 Constructs a scroll bar whose value can never be smaller than minValue
152 or greater than maxValue, whose line step size is lineStep and page
153 step size is pageStep and whose value is initially value (which is
154 guaranteed to be in range using bound()).
155
156 If orientation is Vertical the scroll bar is vertical and if it is
157 Horizontal the scroll bar is horizontal.
158
159 The parent and name arguments are sent on to the QWidget constructor.
160
162 Destructor.
163
165 Returns TRUE if the user has clicked the mouse on the slider and is
166 currently dragging it; otherwise returns FALSE. See the
167 "draggingSlider" property for details.
168
170 This function is called when the scrollbar is hidden.
171
172 Reimplemented from QWidget.
173
175 Returns the line step. See the "lineStep" property for details.
176
178 Returns the scroll bar's maximum value. See the "maxValue" property for
179 details.
180
182 Returns the scroll bar's minimum value. See the "minValue" property for
183 details.
184
186 This signal is emitted when the scroll bar scrolls one line down or
187 right.
188
190 This signal is emitted when the scroll bar scrolls one page down or
191 right.
192
194 Returns the orientation of the scroll bar. See the "orientation"
195 property for details.
196
198 Returns the page step. See the "pageStep" property for details.
199
201 This signal is emitted when the scroll bar scrolls one line up or left.
202
204 This signal is emitted when the scroll bar scrolls one page up or left.
205
207 Sets the line step. See the "lineStep" property for details.
208
210 Sets the scroll bar's maximum value. See the "maxValue" property for
211 details.
212
214 Sets the scroll bar's minimum value. See the "minValue" property for
215 details.
216
218 Sets the orientation of the scroll bar. See the "orientation" property
219 for details.
220
222 Sets the page step. See the "pageStep" property for details.
223
225 Reimplements the virtual function QWidget::setPalette().
226
227 Sets the background color to the mid color for Motif style scroll bars
228 using palette p.
229
230 Reimplemented from QWidget.
231
233 Sets whether scroll bar tracking is enabled to enable. See the
234 "tracking" property for details.
235
237 Sets the scroll bar's value. See the "value" property for details.
238
240 This signal is emitted when the slider is dragged by the user, with the
241 new scroll bar value as an argument.
242
243 This signal is emitted even when tracking is turned off.
244
245 See also tracking, valueChanged(), nextLine(), prevLine(), nextPage(),
246 and prevPage().
247
249 This signal is emitted when the user presses the slider with the mouse.
250
252 Returns the scroll bar slider rectangle.
253
254 See also sliderStart().
255
257 This signal is emitted when the user releases the slider with the
258 mouse.
259
261 Returns the pixel position where the scroll bar slider starts.
262
263 This is equivalent to sliderRect().y() for vertical scroll bars or
264 sliderRect().x() for horizontal scroll bars.
265
267 Returns TRUE if scroll bar tracking is enabled; otherwise returns
268 FALSE. See the "tracking" property for details.
269
271 Returns the scroll bar's value. See the "value" property for details.
272
274 This signal is emitted when the scroll bar value has changed, with the
275 new scroll bar value as an argument.
276
277 Property Documentation
279 This property holds whether the user has clicked the mouse on the
280 slider and is currently dragging it.
281
282 Get this property's value with draggingSlider().
283
285 This property holds the line step.
286
287 When setting lineStep, the virtual stepChange() function will be called
288 if the new line step is different from the previous setting.
289
290 See also setSteps(), QRangeControl::pageStep(), and setRange().
291
292 Set this property's value with setLineStep() and get this property's
293 value with lineStep().
294
296 This property holds the scroll bar's maximum value.
297
298 When setting this property, the QScrollBar::minValue is adjusted if
299 necessary to ensure that the range remains valid.
300
301 See also setRange().
302
303 Set this property's value with setMaxValue() and get this property's
304 value with maxValue().
305
307 This property holds the scroll bar's minimum value.
308
309 When setting this property, the QScrollBar::maxValue is adjusted if
310 necessary to ensure that the range remains valid.
311
312 See also setRange().
313
314 Set this property's value with setMinValue() and get this property's
315 value with minValue().
316
318 This property holds the orientation of the scroll bar.
319
320 The orientation must be Qt::Vertical (the default) or Qt::Horizontal.
321
322 Set this property's value with setOrientation() and get this property's
323 value with orientation().
324
326 This property holds the page step.
327
328 When setting pageStep, the virtual stepChange() function will be called
329 if the new page step is different from the previous setting.
330
331 See also QRangeControl::setSteps(), lineStep, and setRange().
332
333 Set this property's value with setPageStep() and get this property's
334 value with pageStep().
335
337 This property holds whether scroll bar tracking is enabled.
338
339 If tracking is enabled (the default), the scroll bar emits the
340 valueChanged() signal while the slider is being dragged. If tracking is
341 disabled, the scroll bar emits the valueChanged() signal only when the
342 user releases the mouse button after moving the slider.
343
344 Set this property's value with setTracking() and get this property's
345 value with tracking().
346
348 This property holds the scroll bar's value.
349
350 Set this property's value with setValue() and get this property's value
351 with value().
352
353 See also QRangeControl::value() and prevValue().
354
355
357 http://doc.trolltech.com/qscrollbar.html
358 http://www.trolltech.com/faq/tech.html
359
361 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
362 license file included in the distribution for a complete license
363 statement.
364
366 Generated automatically from the source code.
367
369 If you find a bug in Qt, please report it as described in
370 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
371 help you. Thank you.
372
373 The definitive Qt documentation is provided in HTML format; it is
374 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
375 web browser. This man page is provided as a convenience for those users
376 who prefer man pages, although this format is not officially supported
377 by Trolltech.
378
379 If you find errors in this manual page, please report them to qt-
380 bugs@trolltech.com. Please include the name of the manual page
381 (qscrollbar.3qt) and the Qt version (3.3.8).
382
383
384
385Trolltech AS 2 February 2007 QScrollBar(3qt)