QwtSliderBase(3)

NAME
QwtSliderBase - A Base class for sliders.

SYNOPSIS

#include <qwt_sldbase.h>

Inherits QWidget, and QwtDblRange.

Inherited by QwtKnob, QwtSlider, and QwtWheel.

  Public Types
enum { ScrNone, ScrMouse, ScrTimer, ScrDirect, ScrPage }

  Public Slots
void setValue (double val)
void fitValue (double val)
void incValue (int steps)

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

  Public Methods
QwtSliderBase (QWidget *parent=0, const char *name=0)
~QwtSliderBase ()
void setUpdateTime (int t)
void stopMoving ()
void setTracking (bool enable)

  Protected Methods
virtual void setMass (double val)
void setPosition (const QPoint &p)
virtual void valueChange ()
virtual double mass () const
void timerEvent (QTimerEvent *e)
void mousePressEvent (QMouseEvent *e)
void mouseReleaseEvent (QMouseEvent *e)
void mouseMoveEvent (QMouseEvent *e)
virtual double getValue (const QPoint &p)=0
virtual void getScrollMode (const QPoint &p, int &scrollMode, int &direction)=0

  Protected Attributes
int d_scrollMode
double d_mouseOffset
int d_direction
int d_tracking

DETAILED DESCRIPTION

A Base class for sliders.

 QwtSliderBase is a base class for slider widgets. QwtSliderBase handles the mouse events and updates the slider's value accordingly. Derived classes only have to implement the getValue() and getScrollMode() members, and should react to a valueChange(), which normally requires repainting.

CONSTRUCTOR & DESTRUCTOR DOCUMENTATION

  QwtSliderBase::QwtSliderBase (QWidget * parent = 0, const char * name = 0)

Constructor.

  QwtSliderBase::~QwtSliderBase ()

Destructor.

MEMBER FUNCTION DOCUMENTATION

  void QwtSliderBase::fitValue (double val) [virtual, slot]

Set the slider's value to the nearest integer multiple of the step size.

See also:
setValue()

Reimplemented from QwtDblRange.

  virtual void QwtSliderBase::getScrollMode (const QPoint & p, int & scrollMode, int & direction) [protected, pure virtual]

Determine what to do when the user presses a mouse button.

 This function is abstract and has to be implemented by derived classes. It is called on a mousePress event. The derived class can determine what should happen next in dependence of the position where the mouse was pressed by returning scrolling mode and direction. QwtSliderBase knows the following modes:

QwtSliderBase::ScrNone
    Scrolling switched off. Don't change the value.

QwtSliderBase::ScrMouse
    Change the value while the user keeps the button pressed and moves the mouse.

QwtSliderBase::ScrTimer
    Automatic scrolling. Increment the value in the specified direction as long as the user keeps the button pressed.

QwtSliderBase::ScrPage
    Automatic scrolling. Same as ScrTimer, but increment by page size.

Parameters:

p   point where the mouse was pressed

Return values:

scrollMode
    The scrolling mode

direction
    direction: 1, 0, or -1.

Reimplemented in QwtSlider.

  virtual double QwtSliderBase::getValue (const QPoint & p) [protected, pure virtual]

Determine the value corresponding to a specified poind.

 This is an abstract virtual function which is called when the user presses or releases a mouse button or moves the mouse. It has to be implemented by the derived class.

Parameters:

p   point

Reimplemented in QwtSlider.

  void QwtSliderBase::incValue (int steps) [virtual, slot]

Increment the value by a specified number of steps.

Parameters:

steps
    number of steps

Reimplemented from QwtDblRange.

  void QwtSliderBase::mouseMoveEvent (QMouseEvent * e) [protected]

Mouse Move Event handler.

  void QwtSliderBase::mousePressEvent (QMouseEvent * e) [protected]

Mouse press event handler.

  void QwtSliderBase::mouseReleaseEvent (QMouseEvent * e) [protected]

Mouse Release Event handler.

  void QwtSliderBase::setMass (double val) [protected, virtual]

Set the slider's mass for flywheel effect.

 If the slider's mass is greater then 0, it will continue to move after the mouse button has been released. Its speed decreases with time at a rate depending on the slider's mass. A large mass means that it will continue to move for a long time.

Derived widgets may overload this function to make it public.

Parameters:

val new mass in kg

Bug:
 If the mass is smaller than 1g, it is set to zero. The maximal mass is limited to 100kg.

Reimplemented in QwtWheel.

  void QwtSliderBase::setPosition (const QPoint & p) [protected]

Move the slider to a specified point, adjust the value and emit signals if necessary.

  void QwtSliderBase::setTracking (bool enable)

Enables or disables tracking.

 If tracking is enabled, the slider emits a valueChanged() signal whenever its value changes (the default behaviour). If tracking is disabled, the value changed() signal will only be emitted if:

the user releases the mouse button and the value has changed or

at the end of automatic scrolling.

Tracking is enabled by default.

Parameters:

enable
    TRUE (enable) or FALSE (disable) tracking.

  void QwtSliderBase::setUpdateTime (int t)

Specify the update interval for automatic scrolling.

Parameters:

t   update interval in milliseconds

See also:
getScrollMode()

  void QwtSliderBase::setValue (double val) [virtual, slot]

Move the slider to a specified value.

 This function can be used to move the slider to a value which is not an integer multiple of the step size.

Parameters:

val new value

See also:
fitValue

Reimplemented from QwtDblRange.

  void QwtSliderBase::sliderMoved (double value) [signal]

This signal is emitted when the user moves the slider with the mouse.

Parameters:

value
    new value

  void QwtSliderBase::sliderPressed () [signal]

This signal is emitted when the user presses the movable part of the slider (start ScrMouse Mode).

  void QwtSliderBase::sliderReleased () [signal]

This signal is emitted when the user releases the movable part of the slider.

  void QwtSliderBase::stopMoving ()

Stop updating if automatic scrolling is active.

  void QwtSliderBase::timerEvent (QTimerEvent * e) [protected]

Timer event handler.

  void QwtSliderBase::valueChange () [protected, virtual]

Notify change of value

This function can be reimplemented by derived classes in order to keep track of changes, i.e. repaint the widget. The default implementation emits a valueChanged() signal if tracking is enabled.

Parameters:

x   new value

Reimplemented from QwtDblRange.

Reimplemented in QwtSlider.

  void QwtSliderBase::valueChanged (double value) [signal]

Notify a change of value.

 In the default setting (tracking enabled), this signal will be emitted every time the value changes ( see setTracking() ).

Parameters:

value
    new value

AUTHOR

Generated automatically by Doxygen for Qwt User's Guide from the source code.