Qwt User's Guide  6.2.0
QwtWheel Class Reference

The Wheel Widget. More...

#include <qwt_wheel.h>

Inheritance diagram for QwtWheel:

Public Slots

void setValue (double)
 Set a new value without adjusting to the step raster. More...
 
void setTotalAngle (double)
 Set the total angle which the wheel can be turned. More...
 
void setViewAngle (double)
 Specify the visible portion of the wheel. More...
 
void setMass (double)
 Set the slider's mass for flywheel effect. More...
 

Signals

void valueChanged (double value)
 Notify a change of value. More...
 
void wheelPressed ()
 
void wheelReleased ()
 
void wheelMoved (double value)
 

Public Member Functions

 QwtWheel (QWidget *parent=NULL)
 Constructor.
 
virtual ~QwtWheel ()
 Destructor.
 
double value () const
 
void setOrientation (Qt::Orientation)
 Set the wheel's orientation. More...
 
Qt::Orientation orientation () const
 
double totalAngle () const
 
double viewAngle () const
 
void setTickCount (int)
 Adjust the number of grooves in the wheel's surface. More...
 
int tickCount () const
 
void setWheelWidth (int)
 Set the width of the wheel. More...
 
int wheelWidth () const
 
void setWheelBorderWidth (int)
 Set the wheel border width of the wheel. More...
 
int wheelBorderWidth () const
 
void setBorderWidth (int)
 Set the border width. More...
 
int borderWidth () const
 
void setInverted (bool)
 En/Disable inverted appearance. More...
 
bool isInverted () const
 
void setWrapping (bool)
 En/Disable wrapping. More...
 
bool wrapping () const
 
void setSingleStep (double)
 Set the step size of the counter. More...
 
double singleStep () const
 
void setPageStepCount (int)
 Set the page step count. More...
 
int pageStepCount () const
 
void setStepAlignment (bool on)
 En/Disable step alignment. More...
 
bool stepAlignment () const
 
void setRange (double min, double max)
 Set the minimum and maximum values. More...
 
void setMinimum (double)
 
double minimum () const
 
void setMaximum (double)
 
double maximum () const
 
void setUpdateInterval (int)
 Specify the update interval when the wheel is flying. More...
 
int updateInterval () const
 
void setTracking (bool)
 En/Disable tracking. More...
 
bool isTracking () const
 
double mass () const
 

Protected Member Functions

virtual void paintEvent (QPaintEvent *) override
 Qt Paint Event. More...
 
virtual void mousePressEvent (QMouseEvent *) override
 Mouse press event handler. More...
 
virtual void mouseReleaseEvent (QMouseEvent *) override
 Mouse Release Event handler. More...
 
virtual void mouseMoveEvent (QMouseEvent *) override
 Mouse Move Event handler. More...
 
virtual void keyPressEvent (QKeyEvent *) override
 
virtual void wheelEvent (QWheelEvent *) override
 Handle wheel events. More...
 
virtual void timerEvent (QTimerEvent *) override
 Qt timer event. More...
 
void stopFlying ()
 Stop the flying movement of the wheel.
 
QRect wheelRect () const
 
virtual QSize sizeHint () const override
 
virtual QSize minimumSizeHint () const override
 
virtual void drawTicks (QPainter *, const QRectF &)
 
virtual void drawWheelBackground (QPainter *, const QRectF &)
 
virtual double valueAt (const QPoint &) const
 

Detailed Description

The Wheel Widget.

The wheel widget can be used to change values over a very large range in very small steps. Using the setMass() member, it can be configured as a flying wheel.

The default range of the wheel is [0.0, 100.0]

See also
The radio example.

Definition at line 27 of file qwt_wheel.h.

Member Function Documentation

◆ borderWidth()

int QwtWheel::borderWidth ( ) const
Returns
Border width
See also
setBorderWidth()

Definition at line 586 of file qwt_wheel.cpp.

◆ drawTicks()

void QwtWheel::drawTicks ( QPainter *  painter,
const QRectF &  rect 
)
protectedvirtual

Draw the Wheel's ticks

Parameters
painterPainter
rectGeometry for the wheel

Definition at line 817 of file qwt_wheel.cpp.

◆ drawWheelBackground()

void QwtWheel::drawWheelBackground ( QPainter *  painter,
const QRectF &  rect 
)
protectedvirtual

Draw the Wheel's background gradient

Parameters
painterPainter
rectGeometry for the wheel

Definition at line 761 of file qwt_wheel.cpp.

◆ isInverted()

bool QwtWheel::isInverted ( ) const
Returns
True, when the wheel is inverted
See also
setInverted()

Definition at line 1176 of file qwt_wheel.cpp.

◆ isTracking()

bool QwtWheel::isTracking ( ) const
Returns
True, when tracking is enabled
See also
setTracking(), valueChanged(), wheelMoved()

Definition at line 129 of file qwt_wheel.cpp.

◆ keyPressEvent()

void QwtWheel::keyPressEvent ( QKeyEvent *  event)
overrideprotectedvirtual

Handle key events

  • Qt::Key_Home
    Step to minimum()
  • Qt::Key_End
    Step to maximum()
  • Qt::Key_Up
    In case of a horizontal or not inverted vertical wheel the value will be incremented by the step size. For an inverted vertical wheel the value will be decremented by the step size.
  • Qt::Key_Down
    In case of a horizontal or not inverted vertical wheel the value will be decremented by the step size. For an inverted vertical wheel the value will be incremented by the step size.
  • Qt::Key_PageUp
    The value will be incremented by pageStepSize() * singleStepSize().
  • Qt::Key_PageDown
    The value will be decremented by pageStepSize() * singleStepSize().
Parameters
eventKey event

Definition at line 409 of file qwt_wheel.cpp.

◆ mass()

double QwtWheel::mass ( ) const
Returns
mass
See also
setMass()

Definition at line 1240 of file qwt_wheel.cpp.

◆ maximum()

double QwtWheel::maximum ( ) const
Returns
The maximum of the range
See also
setRange(), setMaximum(), minimum()

Definition at line 1114 of file qwt_wheel.cpp.

◆ minimum()

double QwtWheel::minimum ( ) const
Returns
The minimum of the range
See also
setRange(), setMinimum(), maximum()

Definition at line 1094 of file qwt_wheel.cpp.

◆ minimumSizeHint()

QSize QwtWheel::minimumSizeHint ( ) const
overrideprotectedvirtual
Returns
Minimum size hint
Warning
The return value is based on the wheel width.

Definition at line 962 of file qwt_wheel.cpp.

◆ mouseMoveEvent()

void QwtWheel::mouseMoveEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Mouse Move Event handler.

Turn the wheel according to the mouse position

Parameters
eventMouse event

Definition at line 188 of file qwt_wheel.cpp.

◆ mousePressEvent()

void QwtWheel::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Mouse press event handler.

Start movement of the wheel.

Parameters
eventMouse event

Definition at line 163 of file qwt_wheel.cpp.

◆ mouseReleaseEvent()

void QwtWheel::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Mouse Release Event handler.

When the wheel has no mass the movement of the wheel stops, otherwise it starts flying.

Parameters
eventMouse event

Definition at line 237 of file qwt_wheel.cpp.

◆ orientation()

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

Definition at line 661 of file qwt_wheel.cpp.

◆ pageStepCount()

int QwtWheel::pageStepCount ( ) const
Returns
Page step count
See also
setPageStepCount(), singleStep()

Definition at line 1043 of file qwt_wheel.cpp.

◆ paintEvent()

void QwtWheel::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

Qt Paint Event.

Parameters
eventPaint event

Definition at line 736 of file qwt_wheel.cpp.

◆ setBorderWidth()

void QwtWheel::setBorderWidth ( int  width)

Set the border width.

The border defaults to 2.

Parameters
widthBorder width
See also
borderWidth()

Definition at line 576 of file qwt_wheel.cpp.

◆ setInverted()

void QwtWheel::setInverted ( bool  on)

En/Disable inverted appearance.

An inverted wheel increases its values in the opposite direction. The direction of an inverted horizontal wheel will be from right to left an inverted vertical wheel will increase from bottom to top.

Parameters
onEn/Disable inverted appearance
See also
isInverted()

Definition at line 1163 of file qwt_wheel.cpp.

◆ setMass

void QwtWheel::setMass ( double  mass)
slot

Set the slider's mass for flywheel effect.

If the slider's mass is greater then 0, it will continue to move after the mouse button has been released. Its speed decreases with time at a rate depending on the slider's mass. A large mass means that it will continue to move for a long time.

Derived widgets may overload this function to make it public.

Parameters
massNew mass in kg
See also
mass()

Definition at line 1221 of file qwt_wheel.cpp.

◆ setMaximum()

void QwtWheel::setMaximum ( double  value)

Set the maximum value of the range

Parameters
valueMaximum value
See also
setRange(), setMinimum(), maximum()

Definition at line 1105 of file qwt_wheel.cpp.

◆ setMinimum()

void QwtWheel::setMinimum ( double  value)

Set the minimum value of the range

Parameters
valueMinimum value
See also
setRange(), setMaximum(), minimum()
Note
The maximum is adjusted if necessary to ensure that the range remains valid.

Definition at line 1085 of file qwt_wheel.cpp.

◆ setOrientation()

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

Set the wheel's orientation.

The default orientation is Qt::Horizontal.

Parameters
orientationQt::Horizontal or Qt::Vertical.
See also
orientation()

Definition at line 639 of file qwt_wheel.cpp.

◆ setPageStepCount()

void QwtWheel::setPageStepCount ( int  count)

Set the page step count.

pageStepCount is a multiplicator for the single step size that typically corresponds to the user pressing PageUp or PageDown.

A value of 0 disables page stepping.

The default value is 1.

Parameters
countMultiplicator for the single step size
See also
pageStepCount(), setSingleStep()

Definition at line 1034 of file qwt_wheel.cpp.

◆ setRange()

void QwtWheel::setRange ( double  min,
double  max 
)

Set the minimum and maximum values.

The maximum is adjusted if necessary to ensure that the range remains valid. The value might be modified to be inside of the range.

Parameters
minMinimum value
maxMaximum value
See also
minimum(), maximum()

Definition at line 1059 of file qwt_wheel.cpp.

◆ setSingleStep()

void QwtWheel::setSingleStep ( double  stepSize)

Set the step size of the counter.

A value <= 0.0 disables stepping

Parameters
stepSizeSingle step size
See also
singleStep(), setPageStepCount()

Definition at line 980 of file qwt_wheel.cpp.

◆ setStepAlignment()

void QwtWheel::setStepAlignment ( bool  on)

En/Disable step alignment.

When step alignment is enabled value changes initiated by user input ( mouse, keyboard, wheel ) are aligned to the multiples of the single step.

Parameters
onOn/Off
See also
stepAlignment(), setSingleStep()

Definition at line 1004 of file qwt_wheel.cpp.

◆ setTickCount()

void QwtWheel::setTickCount ( int  count)

Adjust the number of grooves in the wheel's surface.

The number of grooves is limited to 6 <= count <= 50. Values outside this range will be clipped. The default value is 10.

Parameters
countNumber of grooves per 360 degrees
See also
tickCount()

Definition at line 519 of file qwt_wheel.cpp.

◆ setTotalAngle

void QwtWheel::setTotalAngle ( double  angle)
slot

Set the total angle which the wheel can be turned.

One full turn of the wheel corresponds to an angle of 360 degrees. A total angle of n*360 degrees means that the wheel has to be turned n times around its axis to get from the minimum value to the maximum value.

The default setting of the total angle is 360 degrees.

Parameters
angletotal angle in degrees
See also
totalAngle()

Definition at line 613 of file qwt_wheel.cpp.

◆ setTracking()

void QwtWheel::setTracking ( bool  enable)

En/Disable tracking.

If tracking is enabled (the default), the wheel emits the valueChanged() signal while the wheel is moving. If tracking is disabled, the wheel emits the valueChanged() signal only when the wheel movement is terminated.

The wheelMoved() signal is emitted regardless id tracking is enabled or not.

Parameters
enableOn/Off
See also
isTracking()

Definition at line 120 of file qwt_wheel.cpp.

◆ setUpdateInterval()

void QwtWheel::setUpdateInterval ( int  interval)

Specify the update interval when the wheel is flying.

Default and minimum value is 50 ms.

Parameters
intervalInterval in milliseconds
See also
updateInterval(), setMass(), setTracking()

Definition at line 142 of file qwt_wheel.cpp.

◆ setValue

void QwtWheel::setValue ( double  value)
slot

Set a new value without adjusting to the step raster.

Parameters
valueNew value
See also
value(), valueChanged()
Warning
The value is clipped when it lies outside the range.

Definition at line 1127 of file qwt_wheel.cpp.

◆ setViewAngle

void QwtWheel::setViewAngle ( double  angle)
slot

Specify the visible portion of the wheel.

You may use this function for fine-tuning the appearance of the wheel. The default value is 175 degrees. The value is limited from 10 to 175 degrees.

Parameters
angleVisible angle in degrees
See also
viewAngle(), setTotalAngle()

Definition at line 676 of file qwt_wheel.cpp.

◆ setWheelBorderWidth()

void QwtWheel::setWheelBorderWidth ( int  borderWidth)

Set the wheel border width of the wheel.

The wheel border must not be smaller than 1 and is limited in dependence on the wheel's size. Values outside the allowed range will be clipped.

The wheel border defaults to 2.

Parameters
borderWidthBorder width
See also
internalBorder()

Definition at line 551 of file qwt_wheel.cpp.

◆ setWheelWidth()

void QwtWheel::setWheelWidth ( int  width)

Set the width of the wheel.

Corresponds to the wheel height for horizontal orientation, and the wheel width for vertical orientation.

Parameters
widththe wheel's width
See also
wheelWidth()

Definition at line 934 of file qwt_wheel.cpp.

◆ setWrapping()

void QwtWheel::setWrapping ( bool  on)

En/Disable wrapping.

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

Parameters
onEn/Disable wrapping
See also
wrapping()

Definition at line 1190 of file qwt_wheel.cpp.

◆ singleStep()

double QwtWheel::singleStep ( ) const
Returns
Single step size
See also
setSingleStep()

Definition at line 989 of file qwt_wheel.cpp.

◆ sizeHint()

QSize QwtWheel::sizeHint ( ) const
overrideprotectedvirtual
Returns
a size hint

Definition at line 952 of file qwt_wheel.cpp.

◆ stepAlignment()

bool QwtWheel::stepAlignment ( ) const
Returns
True, when the step alignment is enabled
See also
setStepAlignment(), singleStep()

Definition at line 1016 of file qwt_wheel.cpp.

◆ tickCount()

int QwtWheel::tickCount ( ) const
Returns
Number of grooves in the wheel's surface.
See also
setTickCnt()

Definition at line 534 of file qwt_wheel.cpp.

◆ timerEvent()

void QwtWheel::timerEvent ( QTimerEvent *  event)
overrideprotectedvirtual

Qt timer event.

The flying wheel effect is implemented using a timer

Parameters
eventTimer event
See also
updateInterval()

Definition at line 283 of file qwt_wheel.cpp.

◆ totalAngle()

double QwtWheel::totalAngle ( ) const
Returns
Total angle which the wheel can be turned.
See also
setTotalAngle()

Definition at line 626 of file qwt_wheel.cpp.

◆ updateInterval()

int QwtWheel::updateInterval ( ) const
Returns
Update interval when the wheel is flying
See also
setUpdateInterval(), mass(), isTracking()

Definition at line 151 of file qwt_wheel.cpp.

◆ value()

double QwtWheel::value ( ) const
Returns
Current value of the wheel
See also
setValue(), valueChanged()

Definition at line 1147 of file qwt_wheel.cpp.

◆ valueAt()

double QwtWheel::valueAt ( const QPoint &  pos) const
protectedvirtual

Determine the value corresponding to a specified point

Parameters
posPosition
Returns
Value corresponding to pos

Definition at line 697 of file qwt_wheel.cpp.

◆ valueChanged

void QwtWheel::valueChanged ( double  value)
signal

Notify a change of value.

When tracking is enabled this signal will be emitted every time the value changes.

Parameters
valuenew value
See also
setTracking()

◆ viewAngle()

double QwtWheel::viewAngle ( ) const
Returns
Visible portion of the wheel
See also
setViewAngle(), totalAngle()

Definition at line 686 of file qwt_wheel.cpp.

◆ wheelBorderWidth()

int QwtWheel::wheelBorderWidth ( ) const
Returns
Wheel border width
See also
setWheelBorderWidth()

Definition at line 563 of file qwt_wheel.cpp.

◆ wheelEvent()

void QwtWheel::wheelEvent ( QWheelEvent *  event)
overrideprotectedvirtual

Handle wheel events.

In/Decrement the value

Parameters
eventWheel event

Definition at line 324 of file qwt_wheel.cpp.

◆ wheelMoved

void QwtWheel::wheelMoved ( double  value)
signal

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

Parameters
valuenew value

◆ wheelPressed

void QwtWheel::wheelPressed ( )
signal

This signal is emitted when the user presses the the wheel with the mouse

◆ wheelRect()

QRect QwtWheel::wheelRect ( ) const
protected
Returns
Rectangle of the wheel without the outer border

Definition at line 594 of file qwt_wheel.cpp.

◆ wheelReleased

void QwtWheel::wheelReleased ( )
signal

This signal is emitted when the user releases the mouse

◆ wheelWidth()

int QwtWheel::wheelWidth ( ) const
Returns
Width of the wheel
See also
setWheelWidth()

Definition at line 944 of file qwt_wheel.cpp.

◆ wrapping()

bool QwtWheel::wrapping ( ) const
Returns
True, when wrapping is set
See also
setWrapping()

Definition at line 1199 of file qwt_wheel.cpp.