The QScrollBar widget provides a vertical or horizontal scroll bar. More...
#include <qscrollbar.h>
Inherits QRangeControl and QWidget.
Type | Name | READ | WRITE | Options |
---|---|---|---|---|
int | minValue | minValue | setMinValue | |
int | maxValue | maxValue | setMaxValue | |
int | lineStep | lineStep | setLineStep | |
int | pageStep | pageStep | setPageStep | |
int | value | value | setValue | |
bool | tracking | tracking | setTracking | |
bool | draggingSlider | draggingSlider | ||
Orientation | orientation | orientation | setOrientation |
A scroll bar allows the user to control a value within a program-definable range, and to give the user visible indication of the current value of a range control.
Scroll bars include four separate controls:
QScrollBar has not much of an API of its own; 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.
Some GUI styles, for example the provided Windows and Motif styles, also use the pageStep() value to calculate the size of the slider.
In addition to the access functions from QRangeControl, QScrollBar has a comprehensive set of signals:
QScrollBar only offers integer ranges. Note that while QScrollBar handles very large numbers, scroll bars on today's 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 keyboard or mouse.
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.
If you need to add scrollbars to an interface, consider using the QScrollView class which encapsulates the common uses for scrollbars.
See also QSlider, QSpinBox, QScrollView and GUI Design Handbook: Scroll Bar
Constructs a scroll bar.
The orientation must be QScrollBar::Vertical or QScrollBar::Horizontal.
The parent and name arguments are sent to the QWidget constructor.
Constructs a vertical scroll bar.
The parent and name arguments are sent to the QWidget constructor.
Constructs a scroll bar.
Arguments:
Returns TRUE if the user has clicked the mouse on the slider and is currently dragging it, or FALSE if not.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
Reimplemented for internal reasons; the API is not affected.
Reimplemented for internal reasons; the API is not affected.
Reimplemented for internal reasons; the API is not affected.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[signal]
This signal is emitted when the scroll bar scrolls one line down/right.
[signal]
This signal is emitted when the scroll bar scrolls one page down/right.
Returns the orientation of the scroll bar; QScrollBar::Vertical or QScrollBar::Horizontal.
See also setOrientation().
Reimplemented for internal reasons; the API is not affected.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[signal]
This signal is emitted when the scroll bar scrolls one line up/left.
[signal]
This signal is emitted when the scroll bar scrolls one page up/left.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
Sets the line step to i.
Calls the virtual stepChange() function if the new line step is different from the previous setting.
See also lineStep(), QRangeControl::setSteps(), setPageStep() and setRange().
A convenience function which just calls setRange( minValue(), i )
See also setRange().
A convenience function which just calls setRange( i, maxValue() )
See also setRange().
[virtual]
Sets the scroll bar orientation. The orientation must be QScrollBar::Vertical or QScrollBar::Horizontal.
See also orientation().
Sets the page step to i.
Calls the virtual stepChange() function if the new page step is different from the previous setting.
See also pageStep(), QRangeControl::setSteps(), setLineStep() and setRange().
[virtual]
Reimplements the virtual function QWidget::setPalette().
Sets the background color to the mid color for Motif style scroll bars.
[virtual]
Enables scroll bar tracking if enable is TRUE, or disables tracking if enable is FALSE.
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.
See also tracking().
Reimplemented for internal reasons; the API is not affected.
[virtual]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[virtual]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[signal]
This signal is emitted when the slider is moved by the user, with the new scroll bar value as an argument.
This signal is emitted even when tracking is turned off.
See also tracking(), valueChanged(), nextLine(), prevLine(), nextPage() and prevPage().
[signal]
This signal is emitted when the user presses the slider with the mouse.
[protected]
Returns the scroll bar slider rectangle.
See also sliderStart().
[signal]
This signal is emitted when the user releases the slider with the mouse.
[protected]
Returns the pixel position where the scroll bar slider starts.
It is equivalent to sliderRect().y() for vertical scroll bars or sliderRect().x() for horizontal scroll bars.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
Returns TRUE if tracking is enabled, or FALSE if tracking is disabled.
Tracking is initially enabled.
See also setTracking().
Reimplemented for internal reasons; the API is not affected.
[signal]
This signal is emitted when the scroll bar value has changed, with the new scroll bar value as an argument.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[virtual protected]
For internal use only.
Reimplemented from QRangeControl.
[virtual protected]
For internal use only.
Reimplemented from QRangeControl.
[virtual protected]
For internal use only.
Reimplemented from QRangeControl.
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.
Copyright © 2000 Trolltech | Trademarks | Qt version 2.2.1
|