Qwt User's Guide  6.1.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QwtAbstractSlider Class Referenceabstract

An abstract base class for slider widgets with a scale. More...

#include <qwt_abstract_slider.h>

Inheritance diagram for QwtAbstractSlider:
Inheritance graph
[legend]

Public Slots

void setValue (double val)
 

Signals

void valueChanged (double value)
 Notify a change of value. More...
 
void sliderPressed ()
 
void sliderReleased ()
 
void sliderMoved (double value)
 

Public Member Functions

 QwtAbstractSlider (QWidget *parent=NULL)
 Constructor. More...
 
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. More...
 
uint totalSteps () const
 
void setSingleSteps (uint)
 Set the number of steps for a single increment. More...
 
uint singleSteps () const
 
void setPageSteps (uint)
 Set the number of steps for a page increment. More...
 
uint pageSteps () const
 
void setStepAlignment (bool)
 Enable step alignment. More...
 
bool stepAlignment () const
 
void setTracking (bool)
 Enables or disables tracking. More...
 
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. More...
 
void setScale (const QwtInterval &)
 Specify a scale. More...
 
void setScale (const QwtScaleDiv &)
 Specify a scale. More...
 
const QwtScaleDivscaleDiv () 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. More...
 
double scaleStepSize () const
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals. More...
 
int scaleMaxMinor () const
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals. More...
 
int scaleMaxMajor () const
 
void setScaleEngine (QwtScaleEngine *)
 Set a scale engine. More...
 
const QwtScaleEnginescaleEngine () const
 
QwtScaleEnginescaleEngine ()
 
int transform (double) const
 
double invTransform (int) const
 
bool isInverted () const
 
double minimum () const
 
double maximum () const
 
const QwtScaleMapscaleMap () const
 

Protected Member Functions

virtual void mousePressEvent (QMouseEvent *)
 
virtual void mouseReleaseEvent (QMouseEvent *)
 
virtual void mouseMoveEvent (QMouseEvent *)
 
virtual void keyPressEvent (QKeyEvent *)
 
virtual void wheelEvent (QWheelEvent *)
 
virtual bool isScrollPosition (const QPoint &pos) const =0
 Determine what to do when the user presses a mouse button. More...
 
virtual double scrolledTo (const QPoint &pos) const =0
 Determine the value for a new position of the movable part of the slider. More...
 
void incrementValue (int numSteps)
 
virtual void scaleChange ()
 
virtual void sliderChange ()
 Calling update()
 
double incrementedValue (double value, int stepCount) const
 
- Protected Member Functions inherited from QwtAbstractScale
void rescale (double lowerBound, double upperBound, double stepSize)
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set a scale draw. More...
 
const QwtAbstractScaleDrawabstractScaleDraw () const
 
QwtAbstractScaleDrawabstractScaleDraw ()
 

Detailed Description

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.

Constructor & Destructor Documentation

QwtAbstractSlider::QwtAbstractSlider ( QWidget *  parent = NULL)
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.

Parameters
parentParent widget

Member Function Documentation

double QwtAbstractSlider::incrementedValue ( double  value,
int  stepCount 
) const
protected

Increment a value

Parameters
valueValue
stepCountNumber of steps
Returns
Incremented value
void QwtAbstractSlider::incrementValue ( int  stepCount)
protected

Increment the slider

The step size depends on the number of totalSteps()

Parameters
stepCountNumber of steps
See Also
setTotalSteps(), incrementedValue()
bool QwtAbstractSlider::invertedControls ( ) const
Returns
True, when the controls are inverted
See Also
setInvertedControls()
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()
virtual bool QwtAbstractSlider::isScrollPosition ( const QPoint &  pos) const
protectedpure virtual

Determine what to do when the user presses a mouse button.

Parameters
posMouse position
Return values
True,whenpos is a valid scroll position
See Also
scrolledTo()

Implemented in QwtKnob, QwtDial, and QwtSlider.

bool QwtAbstractSlider::isTracking ( ) const
Returns
True, when tracking has been enabled
See Also
setTracking()
bool QwtAbstractSlider::isValid ( ) const
Returns
True, when the value is invalid
void QwtAbstractSlider::keyPressEvent ( QKeyEvent *  event)
protectedvirtual

Handles key events

QwtAbstractSlider handles the following keys:

Parameters
eventKey event
See Also
isReadOnly()

Reimplemented in QwtCompass.

void QwtAbstractSlider::mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual

Mouse Move Event handler

Parameters
eventMouse event
void QwtAbstractSlider::mousePressEvent ( QMouseEvent *  event)
protectedvirtual

Mouse press event handler

Parameters
eventMouse event

Reimplemented in QwtSlider.

void QwtAbstractSlider::mouseReleaseEvent ( QMouseEvent *  event)
protectedvirtual

Mouse Release Event handler

Parameters
eventMouse event

Reimplemented in QwtSlider.

uint QwtAbstractSlider::pageSteps ( ) const
Returns
Number of steps
See Also
setPageSteps(), totalSteps(), singleSteps()
void QwtAbstractSlider::scaleChange ( )
protectedvirtual

Update the slider according to modifications of the scale

Reimplemented from QwtAbstractScale.

Reimplemented in QwtDial, and QwtSlider.

virtual double QwtAbstractSlider::scrolledTo ( const QPoint &  pos) const
protectedpure virtual

Determine the value for a new position of the movable part of the slider.

Parameters
posMouse position
Returns
Value for the mouse position
See Also
isScrollPosition()

Implemented in QwtKnob, QwtDial, and QwtSlider.

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 ).

Parameters
onInvert controls, when true
See Also
invertedControls(), keyEvent(), wheelEvent()
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.

Parameters
stepCountNumber of steps
See Also
pageSteps(), setTotalSteps(), setSingleSteps()
void QwtAbstractSlider::setReadOnly ( bool  on)

En/Disable read only mode

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

Parameters
onEnables in case of true
See Also
isReadOnly()
Warning
The focus policy is set to Qt::StrongFocus or Qt::NoFocus
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.

Parameters
stepCountNumber of steps
See Also
singleSteps(), setTotalSteps(), setPageSteps()
void QwtAbstractSlider::setStepAlignment ( bool  on)

Enable step alignment.

When step alignment is enabled values resulting from slider movements are aligned to the step size.

Parameters
onEnable step alignment when true
See Also
stepAlignment()
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.

Parameters
stepCountNumber of steps
See Also
totalSteps(), setSingleSteps(), setPageSteps()
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.

Parameters
ontrue (enable) or false (disable) tracking.
See Also
isTracking(), sliderMoved()
void QwtAbstractSlider::setValid ( bool  on)

Set the value to be valid/invalid

Parameters
onWhen true, the value is invalidated
See Also
setValue()
void QwtAbstractSlider::setValue ( double  value)
slot

Set the slider to the specified value

Parameters
valueNew value
See Also
setValid(), sliderChange(), valueChanged()
void QwtAbstractSlider::setWrapping ( bool  on)

If wrapping is true stepping up from upperBound() value will take you to the minimum() value and vice versa.

Parameters
onEn/Disable wrapping
See Also
wrapping()
uint QwtAbstractSlider::singleSteps ( ) const
Returns
Number of steps
See Also
setSingleSteps(), totalSteps(), pageSteps()
void QwtAbstractSlider::sliderMoved ( double  value)
signal

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

Parameters
valueNew value
See Also
valueChanged()
void QwtAbstractSlider::sliderPressed ( )
signal

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

void QwtAbstractSlider::sliderReleased ( )
signal

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

bool QwtAbstractSlider::stepAlignment ( ) const
Returns
True, when step alignment is enabled
See Also
setStepAlignment()
uint QwtAbstractSlider::totalSteps ( ) const
Returns
Number of steps
See Also
setTotalSteps(), singleSteps(), pageSteps()
void QwtAbstractSlider::valueChanged ( double  value)
signal

Notify a change of value.

When tracking is enabled (default setting), this signal will be emitted every time the value changes.

Parameters
valueNew value
See Also
setTracking(), sliderMoved()
void QwtAbstractSlider::wheelEvent ( QWheelEvent *  event)
protectedvirtual

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().

Parameters
eventWheel event

Reimplemented in QwtDial.

bool QwtAbstractSlider::wrapping ( ) const
Returns
True, when wrapping is set
See Also
setWrapping()