QSlider(3qt)

NAME
QSlider - Vertical or horizontal slider

SYNOPSIS

#include <qslider.h>

Inherits QRangeControl and QWidget.

  Public Members
QSlider ( QWidget * parent=0, const char * name=0 )
QSlider ( Orientation, QWidget * parent=0, const char * name=0 )
QSlider ( int minValue, int maxValue, 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
virtual void setPalette ( const QPalette & )
QRect sliderRect () const
virtual QSize sizeHint () const
virtual void setTickmarks ( TickSetting )
TickSetting tickmarks () const
virtual void setTickInterval ( int )
int tickInterval () const

  Public Slots
void setValue ( int )
void addStep ()
void subtractStep ()

  Signals
void valueChanged ( int value )
void sliderPressed ()
void sliderMoved ( int value )
void sliderReleased ()

  Protected Members
virtual void resizeEvent ( QResizeEvent * )
virtual void paintEvent ( QPaintEvent * )
virtual void keyPressEvent ( QKeyEvent * )
virtual void mousePressEvent ( QMouseEvent * )
virtual void mouseReleaseEvent ( QMouseEvent * )
virtual void mouseMoveEvent ( QMouseEvent * )
virtual void focusInEvent ( QFocusEvent * e )
virtual void valueChange ()
virtual void rangeChange ()
virtual void paintSlider ( QPainter *, const QRect & )
void drawWinGroove ( QPainter *, QCOORD )
void drawTicks ( QPainter *, int, int, int=1 ) const
virtual int thickness () const

DESCRIPTION
The QSlider widget provides a vertical or horizontal slider.

A slider is used to let the user control a value within a program-definable range. In contrast to a QScrollBar, the QSlider widget has a constant size slider and no arrow buttons.

QSlider only offers integer ranges.

The recommended thickness of a slider is given by sizeHint().

Tickmarks may be added using setTickmarks().

A slider has a default focusPolicy() of TabFocus.

[Image Omitted]

[Image Omitted]

See also: QScrollBar, QSpinBox and GUI Design Handbook: Slider

Examples: xform/xform.cpp pref/pref.cpp widgets/widgets.cpp

MEMBER FUNCTION DOCUMENTATION

QSlider::QSlider ( QWidget * parent=0, const char * name=0 )
Constructs a vertical slider.

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

QSlider::QSlider ( Orientation orientation, QWidget * parent=0, const char * name=0 )
Constructs a slider.

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

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

QSlider::QSlider ( int minValue, int maxValue, int pageStep, int value, Orientation orientation, QWidget * parent=0, const char * name=0 )
Constructs a slider.

Arguments:

minValue is the minimum slider value.

maxValue is the maximum slider value.

step is the page step value.

value is the initial value.

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

void QSlider::addStep () [slot]
Moves the slider one pageStep() upwards.

void QSlider::drawTicks ( QPainter * p, int d, int w, int i=1 ) const [protected]
Using p, draws tickmarks at a distance of d from the edge of the widget, using w pixels and with an interval of i.

void QSlider::drawWinGroove ( QPainter * p, QCOORD c ) [protected]
Draws the "groove" on which the slider moves, using the painter p. c gives the distance from the top (or left) edge of the widget to the center of the groove.

void QSlider::focusInEvent ( QFocusEvent * ) [virtual protected]
Handles focus in events for the slider.

Reimplemented from QWidget.

void QSlider::keyPressEvent ( QKeyEvent * e ) [virtual protected]
Handles key press events for the slider.

Reimplemented from QWidget.

void QSlider::mouseMoveEvent ( QMouseEvent * e ) [virtual protected]
Handles mouse move events for the slider.

Reimplemented from QWidget.

void QSlider::mousePressEvent ( QMouseEvent * e ) [virtual protected]
Handles mouse press events for the slider.

Reimplemented from QWidget.

void QSlider::mouseReleaseEvent ( QMouseEvent * ) [virtual protected]
Handles mouse release events for the slider.

Reimplemented from QWidget.

Orientation QSlider::orientation () const
Returns the slider orientation; QSlider::Vertical or QSlider::Horizontal.

See also: setOrientation().

void QSlider::paintEvent ( QPaintEvent * e ) [virtual protected]
Handles paint events for the slider.

Reimplemented from QWidget.

void QSlider::paintSlider ( QPainter * p, const QRect & r ) [virtual protected]
Paints the slider button using painter p with size and position given by r. Reimplement this function to change the look of the slider button.

void QSlider::rangeChange () [virtual protected]
Implements the virtual QRangeControl function.

Reimplemented from QRangeControl.

void QSlider::resizeEvent ( QResizeEvent * ) [virtual protected]
Handles resize events for the slider.

Reimplemented from QWidget.

void QSlider::setOrientation ( Orientation orientation )
Sets the slider orientation. The orientation must be QSlider::Vertical or QSlider::Horizontal.

See also: orientation().

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

Sets the background color to the mid color for Motif style sliders.

Reimplemented from QWidget.

void QSlider::setTickInterval ( int i ) [virtual]
Sets the interval between tickmarks to i. This is a value interval, not a pixel interval. If i is 0, the slider will choose between lineStep() and pageStep(). The initial value of tickInterval() is 0.

See also: tickInterval(), QRangeControl::lineStep() and QRangeControl::pageStep().

Examples: widgets/widgets.cpp

void QSlider::setTickmarks ( TickSetting s ) [virtual]
Sets the way tickmarks are displayed by the slider. s can take the following values:

NoMarks

Above

Left

Below

Right

Both The initial value is NoMarks.

See also: tickmarks() and setTickInterval().

Examples: widgets/widgets.cpp

void QSlider::setTracking ( bool enable )
Enables slider tracking if enable is TRUE, or disables tracking if enable is FALSE.

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

See also: tracking().

Examples: xform/xform.cpp

void QSlider::setValue ( int value ) [slot]
Makes QRangeControl::setValue() available as a slot.

Examples: xform/xform.cpp

QSize QSlider::sizeHint () const [virtual]
Returns the recommended size of the slider. Only the thickness is relevant.

Examples: widgets/widgets.cpp

Reimplemented from QWidget.

void QSlider::sliderMoved ( int value ) [signal]
This signal is emitted when the slider is dragged, with the new slider value as an argument.

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

QRect QSlider::sliderRect () const
Returns the slider handle rectangle. (The actual moving-around thing.).

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

void QSlider::subtractStep () [slot]
Moves the slider one pageStep() downwards.

int QSlider::thickness () const [virtual protected]
Returns the number of pixels to use for the business part of the slider (i.e. the non-tickmark portion). The remaining space is shared equally between the tickmark regions. This function and sizeHint() are closely related; if you change one, you almost certainly have to change the other.

int QSlider::tickInterval () const
Returns the interval between tickmarks. Returns 0 if the slider chooses between pageStep() and lineStep().

See also: setTickInterval().

QSlider::TickSetting QSlider::tickmarks() const
Returns the tickmark settings for this slider.

See also: setTickmarks().

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

Tracking is initially enabled.

See also: setTracking().

void QSlider::valueChange () [virtual protected]
Implements the virtual QRangeControl function.

Reimplemented from QRangeControl.

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

SEE ALSO
http://www.troll.no/qt/qslider.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.