QScrollBar(3qt)

NAME
QScrollBar - Vertical or horizontal scroll bar

SYNOPSIS

#include <qscrollbar.h>

Inherits QRangeControl and QWidget.

  Public Members
QScrollBar ( QWidget * parent=0, const char * name=0 )
QScrollBar ( Orientation, QWidget * parent=0, const char * name=0 )
QScrollBar ( int minValue, int maxValue, int LineStep, int PageStep, int value, Orientation, QWidget * parent=0, const char * name=0 )
void setOrientation ( Orientation )
Orientation orientation () const
void setTracking ( bool enable )
bool tracking () const
bool draggingSlider () const
virtual void setPalette ( const QPalette & )
virtual QSize sizeHint () const

  Signals
void valueChanged ( int value )
void sliderPressed ()
void sliderMoved ( int value )
void sliderReleased ()
void nextLine ()
void prevLine ()
void nextPage ()
void prevPage ()

  Protected Members
virtual void timerEvent ( QTimerEvent * )
virtual void keyPressEvent ( QKeyEvent * )
virtual void resizeEvent ( QResizeEvent * )
virtual void paintEvent ( QPaintEvent * )
virtual void mousePressEvent ( QMouseEvent * )
virtual void mouseReleaseEvent ( QMouseEvent * )
virtual void mouseMoveEvent ( QMouseEvent * )
virtual void valueChange ()
virtual void stepChange ()
virtual void rangeChange ()
int sliderStart () const
QRect sliderRect () const

DESCRIPTION
The QScrollBar widget provides a vertical or horizontal scroll bar.

A scroll bar is used to let the user 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, in order:

The line-up control is a little triangle with which the user can move one line up. The meaning of line is configurable. In e.g. editors and list boxes means one line of text.

The slider is the handle that indicates the current value of the scroll bar, and which the user can drag to change the value.

The page-up/down control is the area on which the slider slides (the scroll bar's background). Clicking here moves the scroll bar up or down one page. The meaning of page too is configurable - in editors and list boxes it means as many lines as there is space for in the widget.

Finally, the line-down control is the arrow on the other end of the scroll bar. Clicking there moves the scroll bar down/rightwards one line.

QScrollBar has not much of an API of its own; it mostly relies on QRangeControl. The most useful functions are setValue() to set the scrollbar directly to some value; addPage(), addLine(), subPage() and subLine() to simulate the effects of clicking (neat for accelerator keys; setSteps() to define the values of pageStep() and lineStep(); and last but NOT least setRange() to set the minValue() and maxValue() of the scrollbar. (QScrollBar has a convenience constructor with which you can set most of that.)

In addition to the access functions from QRangeControl, QScrollBar has a comprehensive set of signals:

valueChanged() - emitted when the scroll bar's value has changed.

sliderPressed() - emitted when the user starts to drag the slider

sliderMoved() - emitted when the user drags the slider

sliderReleased() - emitted when the user releases the slider

nextLine() - emitted when the scroll bar has moved one line down/rightwards. Line is defined in QRangeControl.

prevLine() - emitted when the scroll bar has moved one line up/leftwards.

nextPage() - emitted when the scroll bar has moved one page down/rightwards.

prevPage() - emitted when the scroll bar has moved one page up/leftwards.

QScrollBar only offers integer ranges, and the current implementation has problems when the range is greater than a million or so. (A million is more than sufficient for today's display sizes, however.)

A scroll bar can be controlled by the keyboard, but it has a default focusPolicy() of NoFocus. Use setFocusPolicy() to enable keyboard focus.

[Image Omitted]

[Image Omitted]

See also: QSlider, QSpinBox and GUI Design Handbook: Scroll Bar

MEMBER FUNCTION DOCUMENTATION

QScrollBar::QScrollBar ( QWidget * parent=0, const char * name=0 )
Constructs a vertical scroll bar.

The parent and name arguments are sent to the QWidget constructor.

QScrollBar::QScrollBar ( Orientation orientation, QWidget * parent=0, const char * name=0 )
Constructs a scroll bar.

The orientation must be QScrollBar::Vertical or QScrollBar::Horizontal.

The parent and name arguments are sent to the QWidget constructor.

QScrollBar::QScrollBar ( int minValue, int maxValue, int lineStep, int pageStep, int value, Orientation orientation, QWidget * parent=0, const char * name=0 )
Constructs a scroll bar.

Arguments:

minValue is the minimum scroll bar value.

maxValue is the maximum scroll bar value.

lineStep is the line step value.

pageStep is the page step value.

value is the initial value.

orientation must be QScrollBar::Vertical or QScrollBar::Horizontal. The parent and name arguments are sent to the QWidget constructor.

bool QScrollBar::draggingSlider () const
Returns TRUE if the user has clicked the mouse on the slider and is currenly dragging it, or FALSE if not.

void QScrollBar::keyPressEvent ( QKeyEvent * e ) [virtual protected]
Handles key press events for the scroll bar.

Reimplemented from QWidget.

void QScrollBar::mouseMoveEvent ( QMouseEvent * e ) [virtual protected]
Handles mouse move events for the scroll bar.

Reimplemented from QWidget.

void QScrollBar::mousePressEvent ( QMouseEvent * e ) [virtual protected]
Handles mouse press events for the scroll bar.

Reimplemented from QWidget.

void QScrollBar::mouseReleaseEvent ( QMouseEvent * e ) [virtual protected]
Handles mouse release events for the scroll bar.

Reimplemented from QWidget.

void QScrollBar::nextLine () [signal]
This signal is emitted when the scroll bar scrolls one line down/right.

void QScrollBar::nextPage () [signal]
This signal is emitted when the scroll bar scrolls one page down/right.

Orientation QScrollBar::orientation () const
Returns the scroll bar orientation; QScrollBar::Vertical or QScrollBar::Horizontal.

See also: setOrientation().

void QScrollBar::paintEvent ( QPaintEvent * event ) [virtual protected]
Handles paint events for the scroll bar.

Reimplemented from QWidget.

void QScrollBar::prevLine () [signal]
This signal is emitted when the scroll bar scrolls one line up/left.

void QScrollBar::prevPage () [signal]
This signal is emitted when the scroll bar scrolls one page up/left.

void QScrollBar::rangeChange () [virtual protected]
For internal use only.

Reimplemented from QRangeControl.

void QScrollBar::resizeEvent ( QResizeEvent * ) [virtual protected]
Handles resize events for the scroll bar.

Reimplemented from QWidget.

void QScrollBar::setOrientation ( Orientation orientation )
Sets the scroll bar orientation. The orientation must be QScrollBar::Vertical or QScrollBar::Horizontal.

See also: orientation().

void QScrollBar::setPalette ( const QPalette & p ) [virtual]
Reimplements the virtual function QWidget::setPalette().

Sets the background color to the mid color for Motif style scroll bars.

Reimplemented from QWidget.

void QScrollBar::setTracking ( bool enable )
Enables scroll bar tracking if enable is TRUE, or disables tracking if enable is FALSE.

If tracking is enabled (default), the scroll bar emits the valueChanged() signal whenever the slider is being dragged. If tracking is disabled, the scroll bar emits the valueChanged() signal when the user relases the mouse button (unless the value happens to be the same as before).

See also: tracking().

QSize QScrollBar::sizeHint () const [virtual]
Returns a size hint for this scroll bar.

Reimplemented from QWidget.

void QScrollBar::sliderMoved ( int value ) [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().

void QScrollBar::sliderPressed () [signal]
This signal is emitted when the user presses the slider with the mouse.

QRect QScrollBar::sliderRect () const [protected]
Returns the scroll bar slider rectangle.

See also: sliderStart().

void QScrollBar::sliderReleased () [signal]
This signal is emitted when the user releases the slider with the mouse.

int QScrollBar::sliderStart () const [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.

void QScrollBar::stepChange () [virtual protected]
For internal use only.

Reimplemented from QRangeControl.

void QScrollBar::timerEvent ( QTimerEvent * ) [virtual protected]
Handles timer events for the scroll bar.

Reimplemented from QObject.

bool QScrollBar::tracking () const
Returns TRUE if tracking is enabled, or FALSE if tracking is disabled.

Tracking is initially enabled.

See also: setTracking().

void QScrollBar::valueChange () [virtual protected]
For internal use only.

Reimplemented from QRangeControl.

void QScrollBar::valueChanged ( int value ) [signal]
This signal is emitted when the scroll bar value is changed, with the new scroll bar value as an argument.

SEE ALSO
http://www.troll.no/qt/qscrollbar.html

COPYRIGHT
Copyright 1992-1997 Troll Tech AS. See the LICENSE file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.