QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | Properties | List of all members
QwtSlider Class Reference

The Slider Widget. More...

#include <qwt_slider.h>

Inheritance diagram for QwtSlider:
QwtAbstractSlider QwtAbstractScale

Classes

class  PrivateData
 

Public Types

enum  ScalePosition { NoScale , LeadingScale , TrailingScale }
 Position of the scale. More...
 

Public Member Functions

 QwtSlider (QWidget *parent=nullptr)
 Constructor.
 
 QwtSlider (Qt::Orientation, QWidget *parent=nullptr)
 Constructor with orientation.
 
 ~QwtSlider () override
 Destructor.
 
void setOrientation (Qt::Orientation)
 Set orientation.
 
Qt::Orientation orientation () const
 Return orientation.
 
void setScalePosition (ScalePosition)
 Set scale position.
 
ScalePosition scalePosition () const
 Return scale position.
 
void setTrough (bool)
 Enable/disable trough.
 
bool hasTrough () const
 Check if has trough.
 
void setGroove (bool)
 Enable/disable groove.
 
bool hasGroove () const
 Check if has groove.
 
void setHandleSize (const QSize &)
 Set handle size.
 
QSize handleSize () const
 Return handle size.
 
void setBorderWidth (int)
 Set border width.
 
int borderWidth () const
 Return border width.
 
void setSpacing (int)
 Set spacing.
 
int spacing () const
 Return spacing.
 
void setFlatStyle (bool)
 Set flat style.
 
bool flatStyle () const
 Return flat style.
 
virtual QSize sizeHint () const override
 Return size hint.
 
virtual QSize minimumSizeHint () const override
 Return minimum size hint.
 
void setScaleDraw (QwtScaleDraw *)
 Set scale draw.
 
const QwtScaleDrawscaleDraw () const
 Return scale draw (const version)
 
void setUpdateInterval (int)
 Set update interval.
 
int updateInterval () const
 Return update interval.
 
- Public Member Functions inherited from QwtAbstractSlider
 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 double scrolledTo (const QPoint &) const override
 Calculate scrolled position.
 
virtual bool isScrollPosition (const QPoint &) const override
 Check if position is scroll position.
 
virtual void drawSlider (QPainter *, const QRect &) const
 Draw slider.
 
virtual void drawHandle (QPainter *, const QRect &, int pos) const
 Draw handle.
 
virtual void mousePressEvent (QMouseEvent *) override
 Mouse press event.
 
virtual void mouseReleaseEvent (QMouseEvent *) override
 Mouse release event.
 
virtual void resizeEvent (QResizeEvent *) override
 Resize event.
 
virtual void paintEvent (QPaintEvent *) override
 Paint event.
 
virtual void changeEvent (QEvent *) override
 Change event.
 
virtual void timerEvent (QTimerEvent *) override
 Timer event.
 
virtual bool event (QEvent *) override
 Event handler.
 
virtual void scaleChange () override
 Scale change notification.
 
QRect sliderRect () const
 Return slider rectangle.
 
QRect handleRect () const
 Return handle rectangle.
 
- Protected Member Functions inherited from QwtAbstractSlider
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)
 
void incrementValue (int stepCount)
 Increment the value by a number of steps (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
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

Qt::Orientation orientation
 
ScalePosition scalePosition
 
bool trough
 
bool groove
 
QSize handleSize
 
int borderWidth
 
int spacing
 
bool flatStyle
 
- Properties inherited from QwtAbstractSlider
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
 

Additional Inherited Members

- Public Slots inherited from QwtAbstractSlider
void setValue (double value)
 Set the slider value (English only)
 
- Signals inherited from QwtAbstractSlider
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.
 

Detailed Description

The Slider Widget.

QwtSlider is a slider widget which operates on an interval of type double. Its position is related to a scale showing the current value. The slider can be customized by having a through, a groove - or both.

Member Enumeration Documentation

◆ ScalePosition

Position of the scale.

See also
QwtSlider(), setScalePosition(), setOrientation()
Enumerator
NoScale 

The slider has no scale.

LeadingScale 

The scale is right of a vertical or below a horizontal slider.

TrailingScale 

The scale is left of a vertical or above a horizontal slider.

Constructor & Destructor Documentation

◆ QwtSlider() [1/2]

QwtSlider::QwtSlider ( QWidget *  parent = nullptr)
explicit

Constructor.

Construct vertical slider in QwtSlider::Trough style.

Construct vertical slider in QwtSlider::Trough style with a scale to the left. The scale is initialized to [0.0, 100.0] and the value set to 0.0.

Parameters
parentParent widget
See also
setOrientation(), setScalePosition()

◆ QwtSlider() [2/2]

QwtSlider::QwtSlider ( Qt::Orientation  orientation,
QWidget *  parent = nullptr 
)
explicit

Constructor with orientation.

Construct a slider in QwtSlider::Trough style.

Construct a slider in QwtSlider::Trough style. When orientation is Qt::Vertical the scale will be aligned to the left, otherwise at the top of the slider. The scale is initialized to [0.0, 100.0] and the value set to 0.0.

Parameters
parentParent widget
orientationOrientation of the slider
See also
setOrientation(), setScalePosition()

◆ ~QwtSlider()

QwtSlider::~QwtSlider ( )
override

Destructor.

See also
QwtSlider()

Member Function Documentation

◆ borderWidth()

int QwtSlider::borderWidth ( ) const

Return border width.

Return the border width.

See also
setBorderWidth()

◆ changeEvent()

void QwtSlider::changeEvent ( QEvent *  event)
overrideprotectedvirtual

Change event.

Reimplemented from QwtAbstractScale.

◆ flatStyle()

bool QwtSlider::flatStyle ( ) const

Return flat style.

Return whether flat style is enabled.

See also
setFlatStyle()

◆ handleSize()

QSize QwtSlider::handleSize ( ) const

Return handle size.

Return size of the handle.

See also
setHandleSize()

◆ hasGroove()

bool QwtSlider::hasGroove ( ) const

Check if has groove.

Return true when the groove is visible.

See also
setGroove(), hasTrough()

◆ hasTrough()

bool QwtSlider::hasTrough ( ) const

Check if has trough.

Return true when the trough is visible.

See also
setTrough(), hasGroove()

◆ isScrollPosition()

bool QwtSlider::isScrollPosition ( const QPoint &  pos) const
overrideprotectedvirtual

Check if position is scroll position.

Implements QwtAbstractSlider.

◆ minimumSizeHint()

QSize QwtSlider::minimumSizeHint ( ) const
overridevirtual

Return minimum size hint.

See also
sizeHint()

◆ mousePressEvent()

void QwtSlider::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Mouse press event.

Reimplemented from QwtAbstractSlider.

◆ mouseReleaseEvent()

void QwtSlider::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Mouse release event.

Reimplemented from QwtAbstractSlider.

◆ orientation()

Qt::Orientation QwtSlider::orientation ( ) const

Return orientation.

See also
setOrientation()

◆ scaleChange()

void QwtSlider::scaleChange ( )
overrideprotectedvirtual

Scale change notification.

Reimplemented from QwtAbstractSlider.

◆ scaleDraw()

const QwtScaleDraw * QwtSlider::scaleDraw ( ) const

Return scale draw (const version)

Return the scale draw of the slider (const version)

See also
setScaleDraw()

◆ scalePosition()

QwtSlider::ScalePosition QwtSlider::scalePosition ( ) const

Return scale position.

Return position of the scale.

See also
setScalePosition()

◆ scrolledTo()

double QwtSlider::scrolledTo ( const QPoint &  pos) const
overrideprotectedvirtual

Calculate scrolled position.

Implements QwtAbstractSlider.

◆ setBorderWidth()

void QwtSlider::setBorderWidth ( int  width)

Set border width.

Change the slider's border width.

The border width is used for drawing the slider handle and the trough.

Parameters
widthBorder width
See also
borderWidth()

◆ setFlatStyle()

void QwtSlider::setFlatStyle ( bool  on)

Set flat style.

When enabled (default), the slider is drawn with flat colors instead of 3D embossed effects (qDrawShadePanel/qDrawShadeLine).

Parameters
ontrue for flat style, false for classic 3D style
See also
flatStyle()

◆ setGroove()

void QwtSlider::setGroove ( bool  on)

Enable/disable groove.

En/Disable the groove.

The slider can be customized by showing a groove for the handle.

Parameters
onWhen true, the groove is visible
See also
hasGroove(), setTrough()

◆ setHandleSize()

void QwtSlider::setHandleSize ( const QSize &  size)

Set handle size.

Set the slider's handle size.

When the size is empty the slider handle will be painted with a default size depending on its orientation().

Parameters
sizeNew size
See also
handleSize()

◆ setOrientation()

void QwtSlider::setOrientation ( Qt::Orientation  orientation)

Set orientation.

Set the orientation.

Parameters
orientationAllowed values are Qt::Horizontal and Qt::Vertical
See also
orientation(), scalePosition()

◆ setScaleDraw()

void QwtSlider::setScaleDraw ( QwtScaleDraw scaleDraw)

Set scale draw.

Set a scale draw.

For changing the labels of the scales, it is necessary to derive from QwtScaleDraw and overload QwtScaleDraw::label().

Parameters
scaleDrawScaleDraw object that has to be created with new and will be deleted in ~QwtSlider() or the next call of setScaleDraw()
See also
scaleDraw()

◆ setScalePosition()

void QwtSlider::setScalePosition ( ScalePosition  scalePosition)

Set scale position.

Change the position of the scale.

Parameters
scalePositionPosition of the scale
See also
ScalePosition, scalePosition()

◆ setSpacing()

void QwtSlider::setSpacing ( int  spacing)

Set spacing.

Change the spacing between trough and scale.

A spacing of 0 means that the backbone of the scale is covered by the trough. The default setting is 4 pixels.

Parameters
spacingNumber of pixels
See also
spacing()

◆ setTrough()

void QwtSlider::setTrough ( bool  on)

Enable/disable trough.

En/Disable the trough.

The slider can be customized by showing a trough for the handle.

Parameters
onWhen true, the trough is visible
See also
hasTrough(), setGroove()

◆ setUpdateInterval()

void QwtSlider::setUpdateInterval ( int  interval)

Set update interval.

Specify the update interval for automatic scrolling.

The minimal accepted value is 50 ms.

Parameters
intervalUpdate interval in milliseconds
See also
updateInterval()

◆ sizeHint()

QSize QwtSlider::sizeHint ( ) const
overridevirtual

Return size hint.

Returns
minimumSizeHint()
See also
minimumSizeHint()

◆ spacing()

int QwtSlider::spacing ( ) const

Return spacing.

Return number of pixels between slider and scale.

See also
setSpacing()

◆ updateInterval()

int QwtSlider::updateInterval ( ) const

Return update interval.

Return update interval in milliseconds for automatic scrolling.

See also
setUpdateInterval()

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