Qwt Programmer's manual
QwtSliderBase
QwtSliderBase - A Base class for sliders
#include <qwt_sldbase.h>
QWidget, QwtDblRange
- QwtSliderBase
- constructor
- QwtSliderBase
- destructor
- stopMoving
- stop moving
- setTracking
- enable or disable tracking
- valueChanged
- Emitted when the value has been changed
- sliderPressed
- Emitted when the button has been pressed
QwtSliderbase::sliderReleased() - Emitted when the button has been released
- sliderMoved
- Emitted when the button has been moved
- setValue
- move to value
- fitValue
- move to nearest integer multiple of the step size
- setUpdateTime
-
Change the update time for automatic scrolling
- setMass
-
set the mass for flywheel effect
- setPosition
- adjust the position
- valueChange
- notify change of value
- mass
- return the mass
- getValue
-
Determine the value corresponding to a point p
- getScrollMode
-
Determine the scrolling mode corresponding to a point p
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
QwtSliderBase::QwtSliderBase(QWidget *parent, const char *name)
- QWidget *parent, const char *name
-
Destructor
QwtSliderBase::~QwtSliderBase()
Stop updating if automatic scrolling is active
void QwtSliderBase::stopMoving()
Specify the update interval for automatic scrolling
void QwtSliderBase::setUpdateTime(int t)
- int t
- update interval in milliseconds
getScrollMode
Mouse Release Event handler
void QwtSliderBase::mouseReleaseEvent(QMouseEvent *e)
- QMouseEvent *e
- Qt Mouse Event
Move the slider to a specified point, adjust the value
and emit signals if necessary
void QwtSliderBase::setPosition(const QPoint &p)
- const QPoint &p
-
Enables or disables tracking.
void QwtSliderBase::setTracking(bool enable)
- bool enable
- enable (TRUE) or disable (FALSE) 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.
Timer event handler
void QwtSliderBase::timerEvent(QTimerEvent *e)
- QTimerEvent *e
- Qt timer event
Notify change of value
void QwtSliderBase::valueChange()
- double x
- new 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.
Set the slider's mass for flywheel effect.
void QwtSliderBase::setMass(double val)
- double val
- new mass in kg
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.
Limits: If the mass is smaller than 1g, it is set to zero.
The maximal mass is limited to 100kg.
Derived widgets may overload this function to make it public.
Move the slider to a specified value
void QwtSliderBase::setValue(double val)
- double val
- new value
This function can be used to move the slider to a value
which is not an integer multiple of the step size.
fitValue
Set the slider's value to the nearest integer multiple
of the step size.
void QwtSliderBase::fitValue(double val)
setValue
Increment the value by a specified number of steps
void QwtSliderBase::incValue(int steps)
- int steps
- number of steps
Determine the value corresponding to a specified poind
void QwtSliderBase::getValue(const QPoint &p)
- const QPoint &p
- point
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.
Determine what to do when the user presses a mouse button.
void QwtSliderBase::getScrollMode(const QPoint &p, int &scrollMode, int &direction)
- const QPoint &p
- point where the mouse was pressed
int &scrollMode -- The scrolling mode
int &direction -- direction: 1, 0, or -1.
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.
Notify a change of value.
void QwtSliderBase::valueChanged(double value)
- double value
- new value
In the default setting
(tracking enabled), this signal will be emitted every
time the value changes ( see setTracking() ).
This signal is emitted when the user presses the
movable part of the slider (start ScrMouse Mode).
void QwtSliderBase::sliderPressed()
This signal is emitted when the user releases the
movable part of the slider.
void QwtSliderbase::SliderReleased()
This signal is emitted when the user moves the
slider with the mouse.
void QwtSliderBase::sliderMoved(double value)
- double value
- new value
Qwt Widget Library 02/04/98