Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

QwtSliderBase Class Reference

A Base class for sliders. More...

#include <qwt_sldbase.h>

Inheritance diagram for QwtSliderBase::

QwtDblRange QwtKnob QwtSlider QwtWheel List of all members.

Public Types

enum  ScrollMode {
  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, WFlags flags=0)
virtual ~QwtSliderBase ()
void setUpdateTime (int t)
void stopMoving ()
void setTracking (bool enable)

Protected Methods

virtual void setMass (double val)
virtual double mass () const
void setPosition (const QPoint &p)
virtual void valueChange ()
virtual void timerEvent (QTimerEvent *e)
virtual void mousePressEvent (QMouseEvent *e)
virtual void mouseReleaseEvent (QMouseEvent *e)
virtual void mouseMoveEvent (QMouseEvent *e)
virtual void wheelEvent (QWheelEvent *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,
WFlags    f = 0
 

Constructor.

QwtSliderBase::~QwtSliderBase   [virtual]
 

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:
QwtSliderBase::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, and QwtWheel.

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, and QwtWheel.

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

Increment the value by a specified number of steps.

Parameters:
steps  number of steps

Reimplemented from QwtDblRange.

double QwtSliderBase::mass   const [protected, virtual]
 

Returns:
mass
See also:
QwtSliderBase::setMass

void QwtSliderBase::mouseMoveEvent QMouseEvent *    e [protected, virtual]
 

Mouse Move Event handler.

void QwtSliderBase::mousePressEvent QMouseEvent *    e [protected, virtual]
 

Mouse press event handler.

void QwtSliderBase::mouseReleaseEvent QMouseEvent *    e [protected, virtual]
 

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
See also:
QwtSliderBase::mass

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:
QwtSliderBase::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:
QwtSliderBase::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, virtual]
 

Qt timer event.

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, and QwtWheel.

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

void QwtSliderBase::wheelEvent QWheelEvent *    e [protected, virtual]
 

Qt wheel event.


Generated on Tue May 28 15:31:01 2002 for Qwt User's Guide by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001