QWT 7.0.1
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=NULL)
 Construct vertical slider in QwtSlider::Trough style with a scale to the left.
 
 QwtSlider (Qt::Orientation, QWidget *parent=NULL)
 Construct a slider in QwtSlider::Trough style.
 
virtual ~QwtSlider ()
 Destructor.
 
void setOrientation (Qt::Orientation)
 Set the orientation.
 
Qt::Orientation orientation () const
 
void setScalePosition (ScalePosition)
 Change the position of the scale.
 
ScalePosition scalePosition () const
 
void setTrough (bool)
 En/Disable the trough.
 
bool hasTrough () const
 
void setGroove (bool)
 En/Disable the groove.
 
bool hasGroove () const
 
void setHandleSize (const QSize &)
 Set the slider's handle size.
 
QSize handleSize () const
 
void setBorderWidth (int)
 Change the slider's border width.
 
int borderWidth () const
 
void setSpacing (int)
 Change the spacing between trough and scale.
 
int spacing () const
 
virtual QSize sizeHint () const QWT_OVERRIDE
 
virtual QSize minimumSizeHint () const QWT_OVERRIDE
 
void setScaleDraw (QwtScaleDraw *)
 Set a scale draw.
 
const QwtScaleDrawscaleDraw () const
 
void setUpdateInterval (int)
 Specify the update interval for automatic scrolling.
 
int updateInterval () const
 
- Public Member Functions inherited from QwtAbstractSlider
 QwtAbstractSlider (QWidget *parent=NULL)
 Constructor.
 
virtual ~QwtAbstractSlider ()
 Destructor.
 
void setValid (bool)
 Set the value to be valid/invalid.
 
bool isValid () const
 
double value () const
 Returns the current value.
 
void setWrapping (bool)
 If wrapping is true stepping up from upperBound() value will take you to the minimum() value and vice versa.
 
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)
 En/Disable read only mode.
 
bool isReadOnly () const
 In read only mode the slider can't be controlled by mouse or keyboard.
 
void setInvertedControls (bool)
 Invert wheel and key events.
 
bool invertedControls () const
 
- Public Member Functions inherited from QwtAbstractScale
 QwtAbstractScale (QWidget *parent=NULL)
 Constructor.
 
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 QwtScaleDivscaleDiv () const
 
void setLowerBound (double value)
 Set the lower bound of the scale.
 
double lowerBound () const
 
void setUpperBound (double value)
 Set the upper bound of the scale.
 
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 QwtScaleEnginescaleEngine () const
 
QwtScaleEnginescaleEngine ()
 
int transform (double) const
 Translate a scale value into a widget coordinate.
 
double invTransform (int) const
 Translate a widget coordinate into a scale value.
 
bool isInverted () const
 
double minimum () const
 
double maximum () const
 
const QwtScaleMapscaleMap () const
 

Protected Member Functions

virtual double scrolledTo (const QPoint &) const QWT_OVERRIDE
 Determine the value for a new position of the slider handle.
 
virtual bool isScrollPosition (const QPoint &) const QWT_OVERRIDE
 Determine what to do when the user presses a mouse button.
 
virtual void drawSlider (QPainter *, const QRect &) const
 Draw the slider into the specified rectangle.
 
virtual void drawHandle (QPainter *, const QRect &, int pos) const
 Draw the thumb at a position.
 
virtual void mousePressEvent (QMouseEvent *) QWT_OVERRIDE
 Mouse press event handler.
 
virtual void mouseReleaseEvent (QMouseEvent *) QWT_OVERRIDE
 Mouse release event handler.
 
virtual void resizeEvent (QResizeEvent *) QWT_OVERRIDE
 Qt resize event handler.
 
virtual void paintEvent (QPaintEvent *) QWT_OVERRIDE
 Qt paint event handler.
 
virtual void changeEvent (QEvent *) QWT_OVERRIDE
 Handles QEvent::StyleChange and QEvent::FontChange events.
 
virtual void timerEvent (QTimerEvent *) QWT_OVERRIDE
 Timer event handler.
 
virtual bool event (QEvent *) QWT_OVERRIDE
 Qt event handler.
 
virtual void scaleChange () QWT_OVERRIDE
 Notify changed scale.
 
QRect sliderRect () const
 
QRect handleRect () const
 
- Protected Member Functions inherited from QwtAbstractSlider
virtual void mouseMoveEvent (QMouseEvent *) QWT_OVERRIDE
 Mouse Move Event handler.
 
virtual void keyPressEvent (QKeyEvent *) QWT_OVERRIDE
 Handles key events.
 
virtual void wheelEvent (QWheelEvent *) QWT_OVERRIDE
 Wheel Event handler.
 
void incrementValue (int stepCount)
 Increment the slider.
 
virtual void sliderChange ()
 Calling update()
 
double incrementedValue (double value, int stepCount) const
 Increment a value.
 
- Protected Member Functions inherited from QwtAbstractScale
void rescale (double lowerBound, double upperBound, double stepSize)
 Recalculate the scale division and update the scale.
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set a scale draw.
 
const QwtAbstractScaleDrawabstractScaleDraw () const
 
QwtAbstractScaleDrawabstractScaleDraw ()
 
void updateScaleDraw ()
 Recalculate ticks and scale boundaries.
 

Properties

Qt::Orientation orientation
 
ScalePosition scalePosition
 
bool trough
 
bool groove
 
QSize handleSize
 
int borderWidth
 
int spacing
 
- 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 to the specified value.
 
- Signals inherited from QwtAbstractSlider
void valueChanged (double value)
 Notify a change of value.
 
void sliderPressed ()
 This signal is emitted when the user presses the movable part of the slider.
 
void sliderReleased ()
 This signal is emitted when the user releases the movable part of the slider.
 
void sliderMoved (double value)
 This signal is 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 = NULL)
explicit

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

◆ QwtSlider() [2/2]

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

Construct a slider in QwtSlider::Trough style.

When orientation is Qt::Vertical the scale will be aligned to the left - otherwise at the 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.

Member Function Documentation

◆ borderWidth()

int QwtSlider::borderWidth ( ) const
Returns
the border width.
See also
setBorderWidth()

◆ changeEvent()

void QwtSlider::changeEvent ( QEvent *  event)
protectedvirtual

Handles QEvent::StyleChange and QEvent::FontChange events.

Parameters
eventChange event

Reimplemented from QwtAbstractScale.

◆ drawHandle()

void QwtSlider::drawHandle ( QPainter *  painter,
const QRect &  handleRect,
int  pos 
) const
protectedvirtual

Draw the thumb at a position.

Parameters
painterPainter
handleRectBounding rectangle of the handle
posPosition of the handle marker in widget coordinates

◆ drawSlider()

void QwtSlider::drawSlider ( QPainter *  painter,
const QRect &  sliderRect 
) const
protectedvirtual

Draw the slider into the specified rectangle.

Parameters
painterPainter
sliderRectBounding rectangle of the slider

◆ event()

bool QwtSlider::event ( QEvent *  event)
protectedvirtual

Qt event handler.

Parameters
eventEvent
Returns
true, if event was recognized and processed

◆ handleRect()

QRect QwtSlider::handleRect ( ) const
protected
Returns
Bounding rectangle of the slider handle

◆ handleSize()

QSize QwtSlider::handleSize ( ) const
Returns
Size of the handle.
See also
setHandleSize()

◆ hasGroove()

bool QwtSlider::hasGroove ( ) const
Returns
True, when the groove is visible
See also
setGroove(), hasTrough()

◆ hasTrough()

bool QwtSlider::hasTrough ( ) const
Returns
True, when the trough is visible
See also
setTrough(), hasGroove()

◆ isScrollPosition()

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

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

Parameters
posMouse position
Return values
True,whenhandleRect() contains pos
See also
scrolledTo()

Implements QwtAbstractSlider.

◆ minimumSizeHint()

QSize QwtSlider::minimumSizeHint ( ) const
virtual
Returns
Minimum size hint
See also
sizeHint()

◆ mousePressEvent()

void QwtSlider::mousePressEvent ( QMouseEvent *  event)
protectedvirtual

Mouse press event handler.

Parameters
eventMouse event

Reimplemented from QwtAbstractSlider.

◆ mouseReleaseEvent()

void QwtSlider::mouseReleaseEvent ( QMouseEvent *  event)
protectedvirtual

Mouse release event handler.

Parameters
eventMouse event

Reimplemented from QwtAbstractSlider.

◆ orientation()

Qt::Orientation QwtSlider::orientation ( ) const
Returns
Orientation
See also
setOrientation()

◆ paintEvent()

void QwtSlider::paintEvent ( QPaintEvent *  event)
protectedvirtual

Qt paint event handler.

Parameters
eventPaint event

◆ resizeEvent()

void QwtSlider::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Qt resize event handler.

Parameters
eventResize event

◆ scaleChange()

void QwtSlider::scaleChange ( )
protectedvirtual

Notify changed scale.

Reimplemented from QwtAbstractSlider.

◆ scaleDraw()

const QwtScaleDraw * QwtSlider::scaleDraw ( ) const
Returns
the scale draw of the slider
See also
setScaleDraw()

◆ scalePosition()

QwtSlider::ScalePosition QwtSlider::scalePosition ( ) const
Returns
Position of the scale
See also
setScalePosition()

◆ scrolledTo()

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

Determine the value for a new position of the slider handle.

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

Implements QwtAbstractSlider.

◆ setBorderWidth()

void QwtSlider::setBorderWidth ( int  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()

◆ setGroove()

void QwtSlider::setGroove ( bool  on)

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

◆ setHandleSize()

void QwtSlider::setHandleSize ( const QSize &  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() and backgroundStyle().

Parameters
sizeNew size
See also
handleSize()

◆ setOrientation()

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

Set the orientation.

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

◆ setScaleDraw()

void QwtSlider::setScaleDraw ( QwtScaleDraw scaleDraw)

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)

Change the position of the scale.

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

◆ setSpacing()

void QwtSlider::setSpacing ( int  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)

En/Disable the trough.

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

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

◆ setUpdateInterval()

void QwtSlider::setUpdateInterval ( int  interval)

Specify the update interval for automatic scrolling.

The minimal accepted value is 50 ms.

Parameters
intervalUpdate interval in milliseconds
See also
setUpdateInterval()

◆ sizeHint()

QSize QwtSlider::sizeHint ( ) const
virtual

◆ sliderRect()

QRect QwtSlider::sliderRect ( ) const
protected
Returns
Bounding rectangle of the slider - without the scale

◆ spacing()

int QwtSlider::spacing ( ) const
Returns
Number of pixels between slider and scale
See also
setSpacing()

◆ timerEvent()

void QwtSlider::timerEvent ( QTimerEvent *  event)
protectedvirtual

Timer event handler.

Handles the timer, when the mouse stays pressed inside the sliderRect().

Parameters
eventMouse event

◆ updateInterval()

int QwtSlider::updateInterval ( ) const
Returns
Update interval in milliseconds for automatic scrolling
See also
setUpdateInterval()

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