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

QwtSliderBase Class Reference

Inheritance diagram for QwtSliderBase:

QwtDblRange QwtDial QwtKnob QwtSlider QwtWheel QwtAnalogClock QwtCompass List of all members.

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.


Public Types

enum  ScrollMode {
  ScrNone,
  ScrMouse,
  ScrTimer,
  ScrDirect,
  ScrPage
}

Public Member Functions

 QwtSliderBase (Qt::Orientation orientation, QWidget *parent=0, const char *name=0, WFlags flags=0)
virtual ~QwtSliderBase ()
void setUpdateTime (int t)
void stopMoving ()
void setTracking (bool enable)
virtual void setMass (double val)
virtual double mass () const
virtual void setOrientation (Orientation o)
Orientation orientation () const
bool isReadOnly () const
bool isValid () const
void setValid (bool valid)
virtual void setValue (double val)
virtual void fitValue (double val)
virtual void incValue (int steps)
virtual void setReadOnly (bool)

Protected Member Functions

void valueChanged (double value)
void sliderPressed ()
void sliderReleased ()
void sliderMoved (double value)
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 keyPressEvent (QKeyEvent *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


Constructor & Destructor Documentation

QwtSliderBase::QwtSliderBase Qt::Orientation  orientation,
QWidget *  parent = 0,
const char *  name = 0,
WFlags  flags = 0
 

Constructor.

QwtSliderBase::~QwtSliderBase  )  [virtual]
 

Destructor.


Member Function Documentation

void QwtSliderBase::fitValue double  val  )  [virtual]
 

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.

Implemented in QwtDial, 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

Implemented in QwtDial, QwtSlider, and QwtWheel.

void QwtSliderBase::incValue int  steps  )  [virtual]
 

Increment the value by a specified number of steps.

Parameters:
steps number of steps

Reimplemented from QwtDblRange.

bool QwtSliderBase::isReadOnly  )  const
 

In read only mode the slider canīt be controlled by mouse or keyboard.

Returns:
TRUE if read only
See also:
setReadOnly

bool QwtSliderBase::isValid  )  const
 

See also:
QwtDblRange::isValid

Reimplemented from QwtDblRange.

void QwtSliderBase::keyPressEvent QKeyEvent *  e  )  [protected, virtual]
 

Handles key events

  • Key_Down, KeyLeft
    Decrement by 1
  • Key_Up, Key_Right
    Increment by 1

See also:
isReadOnly()

Reimplemented in QwtCompass, and QwtDial.

double QwtSliderBase::mass  )  const [virtual]
 

Returns:
mass
See also:
QwtSliderBase::setMass

Reimplemented in QwtWheel.

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.

Qt::Orientation QwtSliderBase::orientation  )  const
 

Returns:
Orientation
See also:
QwtSliderBase::setOrientation

void QwtSliderBase::setMass double  val  )  [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::setOrientation Orientation  o  )  [virtual]
 

Set the orientation.

Parameters:
o Orientation. Allowed values are Qt::Horizontal and Qt::Vertical.

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

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

void QwtSliderBase::setReadOnly bool  readOnly  )  [virtual]
 

En/Disable read only mode

In read only mode the slider canīt be controlled by mouse or keyboard.

Parameters:
readOnly Enables in case of TRUE
See also:
isReadOnly

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::setValid bool  valid  ) 
 

See also:
QwtDblRange::isValid

Reimplemented from QwtDblRange.

void QwtSliderBase::setValue double  val  )  [virtual]
 

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  )  [protected]
 

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

Parameters:
value new value

void QwtSliderBase::sliderPressed  )  [protected]
 

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

void QwtSliderBase::sliderReleased  )  [protected]
 

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.

Reimplemented from QwtDblRange.

Reimplemented in QwtDial, QwtSlider, and QwtWheel.

void QwtSliderBase::valueChanged double  value  )  [protected]
 

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 Nov 4 09:53:54 2003 for Qwt User's Guide by doxygen 1.3.4