QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | 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:
QwtAbstractScale QwtDial QwtKnob QwtSlider QwtAnalogClock QwtCompass

Classes

class  PrivateData
 

Public Slots

void setValue (double value)
 Set the slider value (English only)
 

Signals

void valueChanged (double value)
 Notify a change of value.
 
void sliderPressed ()
 Signal emitted when the user presses the movable part of the slider.
 
void sliderReleased ()
 Signal emitted when the user releases the movable part of the slider.
 
void sliderMoved (double value)
 Signal emitted when the user moves the slider with the mouse.
 

Public Member Functions

 QwtAbstractSlider (QWidget *parent=nullptr)
 Constructor for QwtAbstractSlider (English only)
 
 ~QwtAbstractSlider () override
 Destructor for QwtAbstractSlider (English only)
 
void setValid (bool)
 Set whether the slider is valid (English only)
 
bool isValid () const
 Return whether the slider is valid (English only)
 
double value () const
 Return the current value (English only)
 
void setWrapping (bool)
 Set whether wrapping is enabled (English only)
 
bool wrapping () const
 Return whether wrapping is enabled (English only)
 
void setTotalSteps (uint)
 Set the total number of steps (English only)
 
uint totalSteps () const
 Return the total number of steps (English only)
 
void setSingleSteps (uint)
 Set the number of single steps (English only)
 
uint singleSteps () const
 Return the number of single steps (English only)
 
void setPageSteps (uint)
 Set the number of page steps (English only)
 
uint pageSteps () const
 Return the number of page steps (English only)
 
void setStepAlignment (bool)
 Set whether step alignment is enabled (English only)
 
bool stepAlignment () const
 Return whether step alignment is enabled (English only)
 
void setTracking (bool)
 Set whether tracking is enabled (English only)
 
bool isTracking () const
 Return whether tracking is enabled (English only)
 
void setReadOnly (bool)
 Set whether the slider is read-only (English only)
 
bool isReadOnly () const
 Return whether the slider is read-only (English only)
 
void setInvertedControls (bool)
 Set whether controls are inverted (English only)
 
bool invertedControls () const
 Return whether controls are inverted (English only)
 
- Public Member Functions inherited from QwtAbstractScale
 QwtAbstractScale (QWidget *parent=nullptr)
 Constructor for QwtAbstractScale.
 
void setScale (double lowerBound, double upperBound)
 Specify a scale by interval bounds.
 
void setScale (const QwtInterval &)
 Specify a scale by interval.
 
void setScale (const QwtScaleDiv &)
 Specify a scale by scale division.
 
const QwtScaleDivscaleDiv () const
 Return the scale division.
 
void setLowerBound (double value)
 Set the lower bound of the scale.
 
double lowerBound () const
 Return the lower bound of the scale.
 
void setUpperBound (double value)
 Set the upper bound of the scale.
 
double upperBound () const
 Return the upper bound of the scale.
 
void setScaleStepSize (double stepSize)
 Set the step size used for calculating scale division.
 
double scaleStepSize () const
 Return the step size hint.
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals.
 
int scaleMaxMinor () const
 Return the maximum number of minor tick intervals.
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals.
 
int scaleMaxMajor () const
 Return the maximum number of major tick intervals.
 
void setScaleEngine (QwtScaleEngine *)
 Set the scale engine.
 
const QwtScaleEnginescaleEngine () const
 Return the scale engine (const version)
 
QwtScaleEnginescaleEngine ()
 Return the scale engine (non-const version)
 
int transform (double) const
 Transform a scale value to widget coordinates.
 
double invTransform (int) const
 Transform a widget coordinate to scale value.
 
bool isInverted () const
 Check if scale is inverted.
 
double minimum () const
 Return the minimum boundary.
 
double maximum () const
 Return the maximum boundary.
 
const QwtScaleMapscaleMap () const
 Return the scale map.
 

Protected Member Functions

virtual void mousePressEvent (QMouseEvent *) override
 Handle mouse press events (English only)
 
virtual void mouseReleaseEvent (QMouseEvent *) override
 Handle mouse release events (English only)
 
virtual void mouseMoveEvent (QMouseEvent *) override
 Handle mouse move events (English only)
 
virtual void keyPressEvent (QKeyEvent *) override
 Handle key press events (English only)
 
virtual void wheelEvent (QWheelEvent *) override
 Handle wheel events (English only)
 
virtual bool isScrollPosition (const QPoint &pos) const =0
 
virtual double scrolledTo (const QPoint &pos) const =0
 
void incrementValue (int stepCount)
 Increment the value by a number of steps (English only)
 
virtual void scaleChange () override
 Handle scale changes (English only)
 
virtual void sliderChange ()
 Handle slider changes (English only)
 
double incrementedValue (double value, int stepCount) const
 Calculate incremented value (English only)
 
- Protected Member Functions inherited from QwtAbstractScale
virtual void changeEvent (QEvent *) override
 Handle change events (English only)
 
void rescale (double lowerBound, double upperBound, double stepSize)
 Recalculate scale and update scale draw (English only)
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set the scale draw object (English only)
 
const QwtAbstractScaleDrawabstractScaleDraw () const
 Return the scale draw (const version) (English only)
 
QwtAbstractScaleDrawabstractScaleDraw ()
 Return the scale draw (non-const version) (English only)
 
void updateScaleDraw ()
 Update the scale draw (English only)
 

Properties

double value
 
uint totalSteps
 
uint singleSteps
 
uint pageSteps
 
bool stepAlignment
 
bool readOnly
 
bool tracking
 
bool wrapping
 
bool invertedControls
 
- Properties inherited from QwtAbstractScale
double lowerBound
 
double upperBound
 
int scaleMaxMajor
 
int scaleMaxMinor
 
double scaleStepSize
 

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 not 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::QwtAbstractSlider ( QWidget *  parent = nullptr)
explicit

Constructor for QwtAbstractSlider (English only)

Constructor for QwtAbstractSlider.

The scale is initialized to [0.0, 100.0], the number of steps is set to 100 with 1 and 10 as single and page step sizes. Step alignment is enabled. The initial value is invalid.

Parameters
parentParent widget

Destructor for QwtAbstractSlider

Member Function Documentation

◆ incrementedValue()

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

Calculate incremented value (English only)

Increment a value.

Parameters
valueValue to increment
stepCountNumber of steps
Returns
Incremented value
See also
incrementValue(), setTotalSteps()

◆ incrementValue()

void QwtAbstractSlider::incrementValue ( int  stepCount)
protected

Increment the value by a number of steps (English only)

Increment the slider.

The step size depends on the number of totalSteps()

Parameters
stepCountNumber of steps
See also
setTotalSteps(), incrementedValue()

◆ invertedControls()

bool QwtAbstractSlider::invertedControls ( ) const

Return whether controls are inverted (English only)

Check if controls are inverted.

Returns
True, when the controls are inverted
See also
setInvertedControls()

◆ isReadOnly()

bool QwtAbstractSlider::isReadOnly ( ) const

Return whether the slider is read-only (English only)

Check if read-only mode is enabled.

Returns
True if read-only mode is enabled
See also
setReadOnly()

◆ isScrollPosition()

virtual bool QwtAbstractSlider::isScrollPosition ( const QPoint &  pos) const
protectedpure virtual

Implemented in QwtDial, QwtKnob, and QwtSlider.

◆ isTracking()

bool QwtAbstractSlider::isTracking ( ) const

Return whether tracking is enabled (English only)

Check if tracking is enabled.

Returns
True if tracking is enabled
See also
setTracking()

◆ isValid()

bool QwtAbstractSlider::isValid ( ) const

Return whether the slider is valid (English only)

Check if the value is valid.

Returns
True if the value is invalid

◆ keyPressEvent()

void QwtAbstractSlider::keyPressEvent ( QKeyEvent *  event)
overrideprotectedvirtual

Handle key press events (English only)

Handle key press events.

QwtAbstractSlider handles the following keys:

  • Qt::Key_Left: Add/Subtract singleSteps() in direction to lowerBound()
  • Qt::Key_Right: Add/Subtract singleSteps() in direction to upperBound()
  • Qt::Key_Down: Subtract singleSteps(), when invertedControls() is false
  • Qt::Key_Up: Add singleSteps(), when invertedControls() is false
  • Qt::Key_PageDown: Subtract pageSteps(), when invertedControls() is false
  • Qt::Key_PageUp: Add pageSteps(), when invertedControls() is false
  • Qt::Key_Home: Set the value to the minimum()
  • Qt::Key_End: Set the value to the maximum()
    Parameters
    eventKey event
    See also
    isReadOnly(), wheelEvent()

Reimplemented in QwtCompass.

◆ mouseMoveEvent()

void QwtAbstractSlider::mouseMoveEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Handle mouse move events (English only)

Handle mouse move events.

Parameters
eventMouse event

Updates the slider value while scrolling.

See also
mousePressEvent(), mouseReleaseEvent()

◆ mousePressEvent()

void QwtAbstractSlider::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Handle mouse press events (English only)

Handle mouse press events.

Parameters
eventMouse event

Initiates scrolling if the position is valid.

See also
mouseMoveEvent(), mouseReleaseEvent()

Reimplemented in QwtSlider.

◆ mouseReleaseEvent()

void QwtAbstractSlider::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Handle mouse release events (English only)

Handle mouse release events.

Parameters
eventMouse event

Ends scrolling and emits valueChanged() if needed.

See also
mousePressEvent(), mouseMoveEvent()

Reimplemented in QwtSlider.

◆ pageSteps()

uint QwtAbstractSlider::pageSteps ( ) const

Return the number of page steps (English only)

Return the number of page steps.

Returns
Number of steps
See also
setPageSteps(), totalSteps(), singleSteps()

◆ scaleChange()

void QwtAbstractSlider::scaleChange ( )
overrideprotectedvirtual

Handle scale changes (English only)

Update the slider according to modifications of the scale.

Updates the current value to stay within the new scale range and emits valueChanged() if the value was adjusted.

See also
sliderChange(), valueChanged()

Reimplemented from QwtAbstractScale.

Reimplemented in QwtDial, and QwtSlider.

◆ scrolledTo()

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

Implemented in QwtDial, QwtKnob, and QwtSlider.

◆ setInvertedControls()

void QwtAbstractSlider::setInvertedControls ( bool  on)

Set whether controls are inverted (English only)

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

◆ setPageSteps()

void QwtAbstractSlider::setPageSteps ( uint  stepCount)

Set the number of page steps (English only)

Set the number of page steps.

The range of the slider is divided into a number of steps from which the value increments according to user inputs depend.

Parameters
[in]stepCountNumber of steps
See also
pageSteps(), setTotalSteps(), setSingleSteps()

◆ setReadOnly()

void QwtAbstractSlider::setReadOnly ( bool  on)

Set whether the slider is read-only (English only)

Enable or disable read-only mode.

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

Parameters
onEnables read-only mode if true
See also
isReadOnly()
Warning
The focus policy is set to Qt::StrongFocus or Qt::NoFocus

◆ setSingleSteps()

void QwtAbstractSlider::setSingleSteps ( uint  stepCount)

Set the number of single steps (English only)

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
[in]stepCountNumber of steps
See also
singleSteps(), setTotalSteps(), setPageSteps()

◆ setStepAlignment()

void QwtAbstractSlider::setStepAlignment ( bool  on)

Set whether step alignment is enabled (English only)

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

◆ setTotalSteps()

void QwtAbstractSlider::setTotalSteps ( uint  stepCount)

Set the total number of steps (English only)

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
[in]stepCountNumber of steps
See also
totalSteps(), setSingleSteps(), setPageSteps()

◆ setTracking()

void QwtAbstractSlider::setTracking ( bool  on)

Set whether tracking is enabled (English only)

Enable or disable 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 to enable tracking, false to disable
See also
isTracking(), sliderMoved()

◆ setValid()

void QwtAbstractSlider::setValid ( bool  on)

Set whether the slider is valid (English only)

Set the value to be valid or invalid.

Parameters
onWhen true, the value is invalidated
See also
setValue()

◆ setValue

void QwtAbstractSlider::setValue ( double  value)
slot

Set the slider value (English only)

Set the slider to the specified value.

Parameters
valueNew value
See also
setValid(), sliderChange(), valueChanged()

◆ setWrapping()

void QwtAbstractSlider::setWrapping ( bool  on)

Set whether wrapping is enabled (English only)

Enable or disable wrapping.

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

Parameters
onEnable wrapping when true
See also
wrapping()

◆ singleSteps()

uint QwtAbstractSlider::singleSteps ( ) const

Return the number of single steps (English only)

Return the number of single steps.

Returns
Number of steps
See also
setSingleSteps(), totalSteps(), pageSteps()

◆ sliderChange()

void QwtAbstractSlider::sliderChange ( )
protectedvirtual

Handle slider changes (English only)

Handle slider changes.

Called when the slider needs to update its appearance. The default implementation calls update().

See also
setValue(), incrementValue()

Reimplemented in QwtDial.

◆ sliderMoved

void QwtAbstractSlider::sliderMoved ( double  value)
signal

Signal emitted when the user moves the slider with the mouse.

Parameters
valueNew value
See also
valueChanged()

◆ stepAlignment()

bool QwtAbstractSlider::stepAlignment ( ) const

Return whether step alignment is enabled (English only)

Check if step alignment is enabled.

Returns
True, when step alignment is enabled
See also
setStepAlignment()

◆ totalSteps()

uint QwtAbstractSlider::totalSteps ( ) const

Return the total number of steps (English only)

Return the number of steps.

Returns
Number of steps
See also
setTotalSteps(), singleSteps(), pageSteps()

◆ value()

double QwtAbstractSlider::value ( ) const

Return the current value (English only)

Return the current value.

Returns
Current slider value
See also
setValue()

◆ valueChanged

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

◆ wheelEvent()

void QwtAbstractSlider::wheelEvent ( QWheelEvent *  event)
overrideprotectedvirtual

Handle wheel events (English only)

Handle wheel events.

In/decreases the value by a 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
See also
keyPressEvent()

Reimplemented in QwtDial.

◆ wrapping()

bool QwtAbstractSlider::wrapping ( ) const

Return whether wrapping is enabled (English only)

Check if wrapping is enabled.

Returns
True, when wrapping is set
See also
setWrapping()

The documentation for this class was generated from the following files: