Qwt User's Guide
6.0.2
|
#include <qwt_abstract_slider.h>
Public Types | |
enum | ScrollMode { ScrNone, ScrMouse, ScrTimer, ScrDirect, ScrPage } |
Public Slots | |
virtual void | fitValue (double val) |
virtual void | incValue (int steps) |
virtual void | setReadOnly (bool) |
virtual void | setValue (double val) |
Signals | |
void | sliderMoved (double value) |
void | sliderPressed () |
void | sliderReleased () |
void | valueChanged (double value) |
Public Member Functions | |
QwtAbstractSlider (Qt::Orientation, QWidget *parent=NULL) | |
virtual | ~QwtAbstractSlider () |
bool | isReadOnly () const |
bool | isValid () const |
virtual double | mass () const |
Qt::Orientation | orientation () const |
virtual void | setMass (double val) |
virtual void | setOrientation (Qt::Orientation o) |
void | setTracking (bool enable) |
void | setUpdateTime (int t) |
void | setValid (bool valid) |
void | stopMoving () |
![]() | |
QwtDoubleRange () | |
virtual | ~QwtDoubleRange () |
virtual void | incPages (int) |
double | maxValue () const |
double | minValue () const |
int | pageSize () const |
bool | periodic () const |
void | setPeriodic (bool tf) |
void | setRange (double vmin, double vmax, double vstep=0.0, int pagesize=1) |
void | setStep (double) |
double | step () const |
double | value () const |
Protected Member Functions | |
virtual void | getScrollMode (const QPoint &pos, ScrollMode &scrollMode, int &direction) const =0 |
virtual double | getValue (const QPoint &p)=0 |
virtual void | keyPressEvent (QKeyEvent *e) |
virtual void | mouseMoveEvent (QMouseEvent *e) |
double | mouseOffset () const |
virtual void | mousePressEvent (QMouseEvent *e) |
virtual void | mouseReleaseEvent (QMouseEvent *e) |
int | scrollMode () const |
void | setMouseOffset (double) |
virtual void | setPosition (const QPoint &) |
virtual void | timerEvent (QTimerEvent *e) |
virtual void | valueChange () |
virtual void | wheelEvent (QWheelEvent *e) |
![]() | |
double | exactPrevValue () const |
double | exactValue () const |
double | prevValue () const |
virtual void | rangeChange () |
virtual void | stepChange () |
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.
Scroll mode
|
explicit |
Constructor.
orientation | Orientation |
parent | Parent widget |
|
virtualslot |
Set the slider's value to the nearest integer multiple of the step size.
value | Value |
Reimplemented from QwtDoubleRange.
|
protectedpure 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.
pos | point where the mouse was pressed |
scrollMode | The scrolling mode |
direction | direction: 1, 0, or -1. |
|
protectedpure 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.
p | point |
|
virtualslot |
Increment the value by a specified number of steps.
steps | number of steps |
Reimplemented from QwtDoubleRange.
bool QwtAbstractSlider::isReadOnly | ( | ) | const |
In read only mode the slider can't be controlled by mouse or keyboard.
|
inline |
Reimplemented from QwtDoubleRange.
|
protectedvirtual |
Handles key events
e | Key event |
Reimplemented in QwtDial, and QwtCompass.
|
virtual |
|
protectedvirtual |
Mouse Move Event handler
e | Mouse event |
|
protected |
|
protectedvirtual |
Mouse press event handler
e | Mouse event |
|
protectedvirtual |
Mouse Release Event handler
e | Mouse event |
Qt::Orientation QwtAbstractSlider::orientation | ( | ) | const |
|
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.
val | New mass in kg |
Reimplemented in QwtWheel.
|
protected |
|
virtual |
|
protectedvirtual |
Move the slider to a specified point, adjust the value and emit signals if necessary.
|
virtualslot |
En/Disable read only mode
In read only mode the slider can't be controlled by mouse or keyboard.
readOnly | Enables in case of true |
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:
Tracking is enabled by default.
enable | true (enable) or false (disable) tracking. |
void QwtAbstractSlider::setUpdateTime | ( | int | t | ) |
Specify the update interval for automatic scrolling.
t | update interval in milliseconds |
|
inline |
|
virtualslot |
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.
val | new value |
Reimplemented from QwtDoubleRange.
|
signal |
This signal is emitted when the user moves the slider with the mouse.
value | new value |
|
signal |
This signal is emitted when the user presses the movable part of the slider (start ScrMouse Mode).
|
signal |
This signal is emitted when the user releases the movable part of the slider.
|
protectedvirtual |
Qt timer event
e | Timer event |
|
protectedvirtual |
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.
|
signal |
Notify a change of value.
In the default setting (tracking enabled), this signal will be emitted every time the value changes ( see setTracking() ).
value | new value |
|
protectedvirtual |
Wheel Event handler
e | Whell event |