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

QwtAbstractSlider Class Reference

Inheritance diagram for QwtAbstractSlider:

Inheritance graph
[legend]
Collaboration diagram for QwtAbstractSlider:

Collaboration graph
[legend]
List of all members.

Detailed Description

An abstract base class for slider widgets.

QwtAbstractSlider is a base class for slider widgets. It handles 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.

Definition at line 28 of file qwt_abstract_slider.h.

Public Types

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

Public Slots

virtual void setValue (double val)
virtual void fitValue (double val)
virtual void incValue (int steps)
virtual void setReadOnly (bool)

Signals

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

Public Member Functions

 QwtAbstractSlider (Qt::Orientation, QWidget *parent=NULL)
virtual ~QwtAbstractSlider ()
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)

Protected Member Functions

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
void setMouseOffset (double)
double mouseOffset () const
int scrollMode () const


Constructor & Destructor Documentation

QwtAbstractSlider::QwtAbstractSlider Qt::Orientation  ,
QWidget *  parent = NULL
[explicit]
 

Constructor.

Definition at line 49 of file qwt_abstract_slider.cpp.

QwtAbstractSlider::~QwtAbstractSlider  )  [virtual]
 

Destructor.

Definition at line 62 of file qwt_abstract_slider.cpp.


Member Function Documentation

void QwtAbstractSlider::fitValue double  val  )  [virtual, slot]
 

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

See also:
QwtAbstractSlider::setValue()

Reimplemented from QwtDoubleRange.

Definition at line 533 of file qwt_abstract_slider.cpp.

References QwtDoubleRange::fitValue(), and stopMoving().

virtual void QwtAbstractSlider::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. QwtAbstractSlider knows the following modes:

QwtAbstractSlider::ScrNone
Scrolling switched off. Don't change the value.
QwtAbstractSlider::ScrMouse
Change the value while the user keeps the button pressed and moves the mouse.
QwtAbstractSlider::ScrTimer
Automatic scrolling. Increment the value in the specified direction as long as the user keeps the button pressed.
QwtAbstractSlider::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.

Referenced by mousePressEvent(), and wheelEvent().

virtual double QwtAbstractSlider::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.

Referenced by mousePressEvent(), and setPosition().

void QwtAbstractSlider::incValue int  steps  )  [virtual, slot]
 

Increment the value by a specified number of steps.

Parameters:
steps number of steps

Reimplemented from QwtDoubleRange.

Definition at line 545 of file qwt_abstract_slider.cpp.

References QwtDoubleRange::incValue(), and stopMoving().

bool QwtAbstractSlider::isReadOnly  )  const
 

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

Returns:
true if read only
See also:
setReadOnly

Definition at line 92 of file qwt_abstract_slider.cpp.

Referenced by QwtDial::drawFocusIndicator(), QwtDial::keyPressEvent(), QwtCompass::keyPressEvent(), keyPressEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and wheelEvent().

bool QwtAbstractSlider::isValid  )  const
 

See also:
QwtDblRange::isValid

Reimplemented from QwtDoubleRange.

Definition at line 77 of file qwt_abstract_slider.h.

References QwtDoubleRange::isValid().

Referenced by QwtDial::drawContents(), QwtKnob::drawKnob(), QwtAnalogClock::drawNeedle(), QwtCompass::drawScaleContents(), QwtSlider::drawSlider(), QwtDial::keyPressEvent(), keyPressEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and wheelEvent().

void QwtAbstractSlider::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.

Definition at line 359 of file qwt_abstract_slider.cpp.

References QwtDoubleRange::incValue(), isReadOnly(), isValid(), orientation(), QwtDoubleRange::prevValue(), sliderMoved(), and QwtDoubleRange::value().

double QwtAbstractSlider::mass  )  const [virtual]
 

Returns:
mass
See also:
QwtAbstractSlider::setMass

Reimplemented in QwtWheel.

Definition at line 506 of file qwt_abstract_slider.cpp.

Referenced by QwtWheel::mass().

void QwtAbstractSlider::mouseMoveEvent QMouseEvent *  e  )  [protected, virtual]
 

Mouse Move Event handler.

Definition at line 296 of file qwt_abstract_slider.cpp.

References QwtDoubleRange::exactPrevValue(), QwtDoubleRange::exactValue(), isReadOnly(), isValid(), QwtDoubleRange::prevValue(), setPosition(), sliderMoved(), and QwtDoubleRange::value().

void QwtAbstractSlider::mousePressEvent QMouseEvent *  e  )  [protected, virtual]
 

Mouse press event handler.

Definition at line 141 of file qwt_abstract_slider.cpp.

References getScrollMode(), getValue(), isReadOnly(), isValid(), qwtMax, sliderPressed(), stopMoving(), and QwtDoubleRange::value().

void QwtAbstractSlider::mouseReleaseEvent QMouseEvent *  e  )  [protected, virtual]
 

Mouse Release Event handler.

Definition at line 190 of file qwt_abstract_slider.cpp.

References QwtDoubleRange::fitValue(), QwtDoubleRange::incPages(), isReadOnly(), isValid(), setPosition(), sliderReleased(), QwtDoubleRange::step(), stopMoving(), and QwtDoubleRange::value().

Qt::Orientation QwtAbstractSlider::orientation  )  const
 

Returns:
Orientation
See also:
QwtAbstractSlider::setOrientation

Definition at line 111 of file qwt_abstract_slider.cpp.

Referenced by QwtSlider::drawSlider(), QwtSlider::drawThumb(), QwtWheel::drawWheel(), QwtWheel::drawWheelBackground(), QwtSlider::getScrollMode(), QwtWheel::getValue(), QwtSlider::getValue(), keyPressEvent(), QwtSlider::layoutSlider(), QwtWheel::minimumSizeHint(), QwtSlider::minimumSizeHint(), QwtWheel::setOrientation(), and QwtSlider::setOrientation().

void QwtAbstractSlider::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

Reimplemented in QwtWheel.

Definition at line 492 of file qwt_abstract_slider.cpp.

Referenced by QwtWheel::setMass().

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

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

Definition at line 270 of file qwt_abstract_slider.cpp.

References QwtDoubleRange::fitValue(), and getValue().

Referenced by mouseMoveEvent(), and mouseReleaseEvent().

void QwtAbstractSlider::setReadOnly bool  readOnly  )  [virtual, slot]
 

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

Definition at line 79 of file qwt_abstract_slider.cpp.

Referenced by QwtAnalogClock::QwtAnalogClock().

void QwtAbstractSlider::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.

Definition at line 290 of file qwt_abstract_slider.cpp.

void QwtAbstractSlider::setUpdateTime int  t  ) 
 

Specify the update interval for automatic scrolling.

Parameters:
t update interval in milliseconds
See also:
QwtAbstractSlider::getScrollMode()

Definition at line 132 of file qwt_abstract_slider.cpp.

Referenced by QwtKnob::QwtKnob(), and QwtWheel::QwtWheel().

void QwtAbstractSlider::setValid bool  valid  ) 
 

See also:
QwtDblRange::isValid

Reimplemented from QwtDoubleRange.

Definition at line 82 of file qwt_abstract_slider.h.

References QwtDoubleRange::setValid().

Referenced by QwtAnalogClock::setTime().

void QwtAbstractSlider::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:
QwtAbstractSlider::fitValue

Reimplemented from QwtDoubleRange.

Definition at line 520 of file qwt_abstract_slider.cpp.

References QwtDoubleRange::setValue(), and stopMoving().

Referenced by QwtDial::keyPressEvent(), QwtCompass::keyPressEvent(), QwtKnob::QwtKnob(), QwtSlider::QwtSlider(), and QwtAnalogClock::setTime().

void QwtAbstractSlider::sliderMoved double  value  )  [signal]
 

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

Parameters:
value new value

Referenced by QwtDial::keyPressEvent(), keyPressEvent(), mouseMoveEvent(), and wheelEvent().

void QwtAbstractSlider::sliderPressed  )  [signal]
 

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

Referenced by mousePressEvent().

void QwtAbstractSlider::sliderReleased  )  [signal]
 

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

Referenced by mouseReleaseEvent().

void QwtAbstractSlider::stopMoving  ) 
 

Stop updating if automatic scrolling is active.

Definition at line 118 of file qwt_abstract_slider.cpp.

Referenced by fitValue(), incValue(), mousePressEvent(), mouseReleaseEvent(), setValue(), and timerEvent().

void QwtAbstractSlider::timerEvent QTimerEvent *  e  )  [protected, virtual]
 

Qt timer event.

Definition at line 402 of file qwt_abstract_slider.cpp.

References QwtDoubleRange::exactValue(), QwtDoubleRange::fitValue(), QwtDoubleRange::incPages(), QwtDoubleRange::step(), stopMoving(), and QwtDoubleRange::value().

void QwtAbstractSlider::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 QwtDoubleRange.

Reimplemented in QwtDial, QwtSlider, and QwtWheel.

Definition at line 469 of file qwt_abstract_slider.cpp.

References QwtDoubleRange::value(), and valueChanged().

Referenced by QwtWheel::valueChange(), QwtSlider::valueChange(), and QwtDial::valueChange().

void QwtAbstractSlider::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

Referenced by valueChange().

void QwtAbstractSlider::wheelEvent QWheelEvent *  e  )  [protected, virtual]
 

Qt wheel event.

Definition at line 324 of file qwt_abstract_slider.cpp.

References getScrollMode(), QwtDoubleRange::incPages(), isReadOnly(), isValid(), QwtDoubleRange::prevValue(), sliderMoved(), and QwtDoubleRange::value().


Generated on Mon Jan 30 22:16:35 2006 for Qwt User's Guide by  doxygen 1.4.4