Classes | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes | 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]

Classes

class  PrivateData
 

Public Slots

void setValue (double value)
 

Signals

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

Public Member Functions

bool invertedControls () const
 
bool isReadOnly () const
 
bool isTracking () const
 
bool isValid () const
 
uint pageSteps () const
 
 QwtAbstractSlider (QWidget *parent=NULL)
 Constructor. More...
 
void setInvertedControls (bool)
 
void setPageSteps (uint)
 Set the number of steps for a page increment. More...
 
void setReadOnly (bool)
 
void setSingleSteps (uint)
 Set the number of steps for a single increment. More...
 
void setStepAlignment (bool)
 Enable step alignment. More...
 
void setTotalSteps (uint)
 Set the number of steps. More...
 
void setTracking (bool)
 Enables or disables tracking. More...
 
void setValid (bool)
 
void setWrapping (bool)
 
uint singleSteps () const
 
bool stepAlignment () const
 
uint totalSteps () const
 
double value () const
 
bool wrapping () const
 
virtual ~QwtAbstractSlider ()
 Destructor. More...
 
- Public Member Functions inherited from QwtAbstractScale
double invTransform (int) const
 
bool isInverted () const
 
double lowerBound () const
 
double maximum () const
 
double minimum () const
 
 QwtAbstractScale (QWidget *parent=NULL)
 
const QwtScaleDivscaleDiv () const
 
QwtScaleEnginescaleEngine ()
 
const QwtScaleEnginescaleEngine () const
 
const QwtScaleMapscaleMap () const
 
int scaleMaxMajor () const
 
int scaleMaxMinor () const
 
double scaleStepSize () const
 
void setLowerBound (double value)
 
void setScale (const QwtInterval &)
 Specify a scale. More...
 
void setScale (const QwtScaleDiv &)
 Specify a scale. More...
 
void setScale (double lowerBound, double upperBound)
 Specify a scale. More...
 
void setScaleEngine (QwtScaleEngine *)
 Set a scale engine. More...
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals. More...
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals. More...
 
void setScaleStepSize (double stepSize)
 Set the step size used for calculating a scale division. More...
 
void setUpperBound (double value)
 
int transform (double) const
 
double upperBound () const
 
virtual ~QwtAbstractScale ()
 Destructor. More...
 

Protected Member Functions

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

Properties

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

Private Member Functions

double alignedValue (double) const
 
double boundedValue (double) const
 

Private Attributes

PrivateDatam_data
 

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.

Definition at line 32 of file qwt_abstract_slider.h.

Constructor & Destructor Documentation

◆ QwtAbstractSlider()

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

Definition at line 91 of file qwt_abstract_slider.cpp.

◆ ~QwtAbstractSlider()

QwtAbstractSlider::~QwtAbstractSlider ( )
virtual

Destructor.

Definition at line 101 of file qwt_abstract_slider.cpp.

Member Function Documentation

◆ alignedValue()

double QwtAbstractSlider::alignedValue ( double  value) const
private

Definition at line 757 of file qwt_abstract_slider.cpp.

◆ boundedValue()

double QwtAbstractSlider::boundedValue ( double  value) const
private

Definition at line 712 of file qwt_abstract_slider.cpp.

◆ incrementedValue()

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

Increment a value

Parameters
valueValue
stepCountNumber of steps
Returns
Incremented value

Definition at line 670 of file qwt_abstract_slider.cpp.

◆ incrementValue()

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

Definition at line 650 of file qwt_abstract_slider.cpp.

◆ invertedControls()

bool QwtAbstractSlider::invertedControls ( ) const

◆ isReadOnly()

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

Definition at line 159 of file qwt_abstract_slider.cpp.

◆ isScrollPosition()

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.

◆ isTracking()

bool QwtAbstractSlider::isTracking ( ) const
Returns
True, when tracking has been enabled
See also
setTracking()

Definition at line 186 of file qwt_abstract_slider.cpp.

◆ isValid()

bool QwtAbstractSlider::isValid ( ) const
Returns
True, when the value is invalid

Definition at line 125 of file qwt_abstract_slider.cpp.

◆ keyPressEvent()

void QwtAbstractSlider::keyPressEvent ( QKeyEvent *  event)
protectedvirtual

Handles key events

QwtAbstractSlider handles the following keys:

Parameters
eventKey event
See also
isReadOnly()

Reimplemented in QwtCompass.

Definition at line 370 of file qwt_abstract_slider.cpp.

◆ mouseMoveEvent()

void QwtAbstractSlider::mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual

Mouse Move Event handler

Parameters
eventMouse event

Definition at line 220 of file qwt_abstract_slider.cpp.

◆ mousePressEvent()

void QwtAbstractSlider::mousePressEvent ( QMouseEvent *  event)
protectedvirtual

Mouse press event handler

Parameters
eventMouse event

Reimplemented in QwtSlider.

Definition at line 195 of file qwt_abstract_slider.cpp.

◆ mouseReleaseEvent()

void QwtAbstractSlider::mouseReleaseEvent ( QMouseEvent *  event)
protectedvirtual

Mouse Release Event handler

Parameters
eventMouse event

Reimplemented in QwtSlider.

Definition at line 265 of file qwt_abstract_slider.cpp.

◆ pageSteps()

uint QwtAbstractSlider::pageSteps ( ) const

◆ scaleChange()

void QwtAbstractSlider::scaleChange ( )
protectedvirtual

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.

◆ scrolledTo()

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.

◆ setInvertedControls()

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

Definition at line 628 of file qwt_abstract_slider.cpp.

◆ setPageSteps()

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

Definition at line 524 of file qwt_abstract_slider.cpp.

◆ setReadOnly()

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

Definition at line 141 of file qwt_abstract_slider.cpp.

◆ setSingleSteps()

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

Definition at line 499 of file qwt_abstract_slider.cpp.

◆ setStepAlignment()

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

Definition at line 547 of file qwt_abstract_slider.cpp.

◆ setTotalSteps()

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

Definition at line 474 of file qwt_abstract_slider.cpp.

◆ setTracking()

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

Definition at line 177 of file qwt_abstract_slider.cpp.

◆ setValid()

void QwtAbstractSlider::setValid ( bool  on)

Set the value to be valid/invalid

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

Definition at line 113 of file qwt_abstract_slider.cpp.

◆ setValue

void QwtAbstractSlider::setValue ( double  value)
slot

Set the slider to the specified value

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

Definition at line 570 of file qwt_abstract_slider.cpp.

◆ setWrapping()

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

Definition at line 599 of file qwt_abstract_slider.cpp.

◆ singleSteps()

uint QwtAbstractSlider::singleSteps ( ) const

◆ sliderChange()

void QwtAbstractSlider::sliderChange ( )
protectedvirtual

Calling update()

Reimplemented in QwtDial.

Definition at line 829 of file qwt_abstract_slider.cpp.

◆ sliderMoved

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

◆ sliderPressed

void QwtAbstractSlider::sliderPressed ( )
signal

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

◆ sliderReleased

void QwtAbstractSlider::sliderReleased ( )
signal

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

◆ stepAlignment()

bool QwtAbstractSlider::stepAlignment ( ) const

◆ totalSteps()

uint QwtAbstractSlider::totalSteps ( ) const

◆ value()

double QwtAbstractSlider::value ( ) const

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

Definition at line 296 of file qwt_abstract_slider.cpp.

◆ wrapping()

bool QwtAbstractSlider::wrapping ( ) const

Member Data Documentation

◆ m_data

PrivateData* QwtAbstractSlider::m_data
private

Definition at line 170 of file qwt_abstract_slider.h.

Property Documentation

◆ invertedControls

bool QwtAbstractSlider::invertedControls
readwrite
Returns
True, when the controls are inverted
See also
setInvertedControls()

Definition at line 54 of file qwt_abstract_slider.h.

◆ pageSteps

uint QwtAbstractSlider::pageSteps
readwrite
Returns
Number of steps
See also
setPageSteps(), totalSteps(), singleSteps()

Definition at line 47 of file qwt_abstract_slider.h.

◆ readOnly

bool QwtAbstractSlider::readOnly
readwrite

Definition at line 50 of file qwt_abstract_slider.h.

◆ singleSteps

uint QwtAbstractSlider::singleSteps
readwrite
Returns
Number of steps
See also
setSingleSteps(), totalSteps(), pageSteps()

Definition at line 46 of file qwt_abstract_slider.h.

◆ stepAlignment

bool QwtAbstractSlider::stepAlignment
readwrite
Returns
True, when step alignment is enabled
See also
setStepAlignment()

Definition at line 48 of file qwt_abstract_slider.h.

◆ totalSteps

uint QwtAbstractSlider::totalSteps
readwrite
Returns
Number of steps
See also
setTotalSteps(), singleSteps(), pageSteps()

Definition at line 45 of file qwt_abstract_slider.h.

◆ tracking

bool QwtAbstractSlider::tracking
readwrite

Definition at line 51 of file qwt_abstract_slider.h.

◆ value

double QwtAbstractSlider::value
readwrite

Returns the current value.

Definition at line 43 of file qwt_abstract_slider.h.

◆ wrapping

bool QwtAbstractSlider::wrapping
readwrite
Returns
True, when wrapping is set
See also
setWrapping()

Definition at line 52 of file qwt_abstract_slider.h.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:50