Qwt User's Guide 6.3.0
|
An abstract base class for slider widgets with a scale. More...
#include <qwt_abstract_slider.h>
Public Slots | |
void | setValue (double value) |
Signals | |
void | valueChanged (double value) |
Notify a change of value. | |
void | sliderPressed () |
void | sliderReleased () |
void | sliderMoved (double value) |
Public Member Functions | |
QwtAbstractSlider (QWidget *parent=NULL) | |
Constructor. | |
virtual | ~QwtAbstractSlider () |
Destructor. | |
void | setValid (bool) |
bool | isValid () const |
double | value () const |
Returns the current value. | |
void | setWrapping (bool) |
bool | wrapping () const |
void | setTotalSteps (uint) |
Set the number of steps. | |
uint | totalSteps () const |
void | setSingleSteps (uint) |
Set the number of steps for a single increment. | |
uint | singleSteps () const |
void | setPageSteps (uint) |
Set the number of steps for a page increment. | |
uint | pageSteps () const |
void | setStepAlignment (bool) |
Enable step alignment. | |
bool | stepAlignment () const |
void | setTracking (bool) |
Enables or disables tracking. | |
bool | isTracking () const |
void | setReadOnly (bool) |
bool | isReadOnly () const |
void | setInvertedControls (bool) |
bool | invertedControls () const |
Public Member Functions inherited from QwtAbstractScale | |
QwtAbstractScale (QWidget *parent=NULL) | |
virtual | ~QwtAbstractScale () |
Destructor. | |
void | setScale (double lowerBound, double upperBound) |
Specify a scale. | |
void | setScale (const QwtInterval &) |
Specify a scale. | |
void | setScale (const QwtScaleDiv &) |
Specify a scale. | |
const QwtScaleDiv & | scaleDiv () const |
void | setLowerBound (double value) |
double | lowerBound () const |
void | setUpperBound (double value) |
double | upperBound () const |
void | setScaleStepSize (double stepSize) |
Set the step size used for calculating a scale division. | |
double | scaleStepSize () const |
void | setScaleMaxMajor (int ticks) |
Set the maximum number of major tick intervals. | |
int | scaleMaxMinor () const |
void | setScaleMaxMinor (int ticks) |
Set the maximum number of minor tick intervals. | |
int | scaleMaxMajor () const |
void | setScaleEngine (QwtScaleEngine *) |
Set a scale engine. | |
const QwtScaleEngine * | scaleEngine () const |
QwtScaleEngine * | scaleEngine () |
int | transform (double) const |
double | invTransform (int) const |
bool | isInverted () const |
double | minimum () const |
double | maximum () const |
const QwtScaleMap & | scaleMap () const |
Protected Member Functions | |
virtual void | mousePressEvent (QMouseEvent *) override |
virtual void | mouseReleaseEvent (QMouseEvent *) override |
virtual void | mouseMoveEvent (QMouseEvent *) override |
virtual void | keyPressEvent (QKeyEvent *) override |
virtual void | wheelEvent (QWheelEvent *) override |
virtual bool | isScrollPosition (const QPoint &pos) const =0 |
Determine what to do when the user presses a mouse button. | |
virtual double | scrolledTo (const QPoint &pos) const =0 |
Determine the value for a new position of the movable part of the slider. | |
void | incrementValue (int stepCount) |
virtual void | scaleChange () override |
virtual void | sliderChange () |
Calling update() | |
double | incrementedValue (double value, int stepCount) const |
Protected Member Functions inherited from QwtAbstractScale | |
virtual void | changeEvent (QEvent *) override |
void | rescale (double lowerBound, double upperBound, double stepSize) |
void | setAbstractScaleDraw (QwtAbstractScaleDraw *) |
Set a scale draw. | |
const QwtAbstractScaleDraw * | abstractScaleDraw () const |
QwtAbstractScaleDraw * | abstractScaleDraw () |
void | updateScaleDraw () |
An abstract base class for slider widgets with a scale.
A slider widget displays a value according to a scale. The class is designed as a common super class for widgets like QwtKnob, QwtDial and QwtSlider.
When the slider is nor readOnly() its value can be modified by keyboard, mouse and wheel inputs.
The range of the slider is divided into a number of steps from which the value increments according to user inputs depend. Only for linear scales the number of steps correspond with a fixed step size.
Definition at line 32 of file qwt_abstract_slider.h.
|
explicit |
Constructor.
The scale is initialized to [0.0, 100.0], the number of steps is set to 100 with 1 and 10 and single an page step sizes. Step alignment is enabled.
The initial value is invalid.
parent | Parent widget |
Definition at line 91 of file qwt_abstract_slider.cpp.
|
virtual |
Destructor.
Definition at line 101 of file qwt_abstract_slider.cpp.
|
protected |
Increment a value
value | Value |
stepCount | Number of steps |
Definition at line 670 of file qwt_abstract_slider.cpp.
|
protected |
Increment the slider
The step size depends on the number of totalSteps()
stepCount | Number of steps |
Definition at line 650 of file qwt_abstract_slider.cpp.
bool QwtAbstractSlider::invertedControls | ( | ) | const |
Definition at line 637 of file qwt_abstract_slider.cpp.
bool QwtAbstractSlider::isReadOnly | ( | ) | const |
In read only mode the slider can't be controlled by mouse or keyboard.
Definition at line 159 of file qwt_abstract_slider.cpp.
|
protectedpure virtual |
Determine what to do when the user presses a mouse button.
pos | Mouse position |
True,when | pos is a valid scroll position |
bool QwtAbstractSlider::isTracking | ( | ) | const |
Definition at line 186 of file qwt_abstract_slider.cpp.
bool QwtAbstractSlider::isValid | ( | ) | const |
Definition at line 125 of file qwt_abstract_slider.cpp.
|
overrideprotectedvirtual |
Handles key events
QwtAbstractSlider handles the following keys:
event | Key event |
Reimplemented in QwtCompass.
Definition at line 370 of file qwt_abstract_slider.cpp.
|
overrideprotectedvirtual |
Mouse Move Event handler
event | Mouse event |
Definition at line 220 of file qwt_abstract_slider.cpp.
|
overrideprotectedvirtual |
Mouse press event handler
event | Mouse event |
Reimplemented in QwtSlider.
Definition at line 195 of file qwt_abstract_slider.cpp.
|
overrideprotectedvirtual |
Mouse Release Event handler
event | Mouse event |
Reimplemented in QwtSlider.
Definition at line 265 of file qwt_abstract_slider.cpp.
uint QwtAbstractSlider::pageSteps | ( | ) | const |
Definition at line 533 of file qwt_abstract_slider.cpp.
|
overrideprotectedvirtual |
Update the slider according to modifications of the scale
Reimplemented from QwtAbstractScale.
Reimplemented in QwtDial, and QwtSlider.
Definition at line 811 of file qwt_abstract_slider.cpp.
|
protectedpure virtual |
Determine the value for a new position of the movable part of the slider.
pos | Mouse position |
void QwtAbstractSlider::setInvertedControls | ( | bool | on | ) |
Invert wheel and key events
Usually scrolling the mouse wheel "up" and using keys like page up will increase the slider's value towards its maximum. When invertedControls() is enabled the value is scrolled towards its minimum.
Inverting the controls might be f.e. useful for a vertical slider with an inverted scale ( decreasing from top to bottom ).
on | Invert controls, when true |
Definition at line 628 of file qwt_abstract_slider.cpp.
void QwtAbstractSlider::setPageSteps | ( | uint | stepCount | ) |
Set the number of steps for a page increment.
The range of the slider is divided into a number of steps from which the value increments according to user inputs depend.
stepCount | Number of steps |
Definition at line 524 of file qwt_abstract_slider.cpp.
void QwtAbstractSlider::setReadOnly | ( | bool | on | ) |
En/Disable read only mode
In read only mode the slider can't be controlled by mouse or keyboard.
on | Enables in case of true |
Definition at line 141 of file qwt_abstract_slider.cpp.
void QwtAbstractSlider::setSingleSteps | ( | uint | stepCount | ) |
Set the number of steps for a single increment.
The range of the slider is divided into a number of steps from which the value increments according to user inputs depend.
stepCount | Number of steps |
Definition at line 499 of file qwt_abstract_slider.cpp.
void QwtAbstractSlider::setStepAlignment | ( | bool | on | ) |
Enable step alignment.
When step alignment is enabled values resulting from slider movements are aligned to the step size.
on | Enable step alignment when true |
Definition at line 547 of file qwt_abstract_slider.cpp.
void QwtAbstractSlider::setTotalSteps | ( | uint | stepCount | ) |
Set the number of steps.
The range of the slider is divided into a number of steps from which the value increments according to user inputs depend.
The default setting is 100.
stepCount | Number of steps |
Definition at line 474 of file qwt_abstract_slider.cpp.
void QwtAbstractSlider::setTracking | ( | bool | on | ) |
Enables or disables tracking.
If tracking is enabled, the slider emits the valueChanged() signal while the movable part of the slider is being dragged. If tracking is disabled, the slider emits the valueChanged() signal only when the user releases the slider.
Tracking is enabled by default.
on | true (enable) or false (disable) tracking. |
Definition at line 177 of file qwt_abstract_slider.cpp.
void QwtAbstractSlider::setValid | ( | bool | on | ) |
Set the value to be valid/invalid
on | When true, the value is invalidated |
Definition at line 113 of file qwt_abstract_slider.cpp.
|
slot |
Set the slider to the specified value
value | New value |
Definition at line 570 of file qwt_abstract_slider.cpp.
void QwtAbstractSlider::setWrapping | ( | bool | on | ) |
If wrapping is true stepping up from upperBound() value will take you to the minimum() value and vice versa.
on | En/Disable wrapping |
Definition at line 599 of file qwt_abstract_slider.cpp.
uint QwtAbstractSlider::singleSteps | ( | ) | const |
Definition at line 508 of file qwt_abstract_slider.cpp.
|
protectedvirtual |
|
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.
|
signal |
This signal is emitted when the user releases the movable part of the slider.
bool QwtAbstractSlider::stepAlignment | ( | ) | const |
Definition at line 559 of file qwt_abstract_slider.cpp.
uint QwtAbstractSlider::totalSteps | ( | ) | const |
Definition at line 483 of file qwt_abstract_slider.cpp.
double QwtAbstractSlider::value | ( | ) | const |
Returns the current value.
Definition at line 587 of file qwt_abstract_slider.cpp.
|
signal |
Notify a change of value.
When tracking is enabled (default setting), this signal will be emitted every time the value changes.
value | New value |
|
overrideprotectedvirtual |
Wheel Event handler
In/decreases the value by s number of steps. The direction depends on the invertedControls() property.
When the control or shift modifier is pressed the wheel delta ( divided by 120 ) is mapped to an increment according to pageSteps(). Otherwise it is mapped to singleSteps().
event | Wheel event |
Reimplemented in QwtDial.
Definition at line 296 of file qwt_abstract_slider.cpp.
bool QwtAbstractSlider::wrapping | ( | ) | const |
Definition at line 608 of file qwt_abstract_slider.cpp.