Qwt User's Guide: QwtWheel Class Reference

Qwt User's Guide 6.0.1

- Main Page
- Related Pages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions

# QwtWheel Class Reference

The Wheel Widget. More...

`#include <qwt_wheel.h>`

Inheritance diagram for QwtWheel:
[legend]

List of all members.

## Public Types
enum | ScrollMode { ScrNone, ScrMouse, ScrTimer, ScrDirect, ScrPage }
## Public Slots
virtual void | fitValue (double val)
virtual void | incValue (int steps)
virtual void | setReadOnly (bool)
void | setTotalAngle (double)
virtual void | setValue (double val)
void | setViewAngle (double)
## Signals
void | sliderMoved (double value)
void | sliderPressed ()
void | sliderReleased ()
void | valueChanged (double value)
## Public Member Functions
int | borderWidth () const
virtual void | incPages (int)
bool | isReadOnly () const
bool | isValid () const
double | mass () const
double | maxValue () const
virtual QSize | minimumSizeHint () const
double | minValue () const
Qt::Orientation | orientation () const
int | pageSize () const
bool | periodic () const
| QwtWheel (QWidget *parent=NULL)
void | setBorderWidth (int)
void | setMass (double)
virtual void | setOrientation (Qt::Orientation)
void | setPeriodic (bool tf)
void | setRange (double vmin, double vmax, double vstep=0.0, int pagesize=1)
void | setStep (double)
void | setTickCnt (int)
void | setTracking (bool enable)
void | setUpdateTime (int t)
void | setValid (bool valid)
void | setWheelBorderWidth (int)
void | setWheelWidth (int)
virtual QSize | sizeHint () const
double | step () const
void | stopMoving ()
int | tickCnt () const
double | totalAngle () const
double | value () const
double | viewAngle () const
int | wheelBorderWidth () const
QRect | wheelRect () const
int | wheelWidth () const
virtual | ~QwtWheel ()
## Protected Member Functions
virtual void | drawTicks (QPainter *, const QRectF &)
virtual void | drawWheelBackground (QPainter *, const QRectF &)
double | exactPrevValue () const
double | exactValue () const
virtual void | getScrollMode (const QPoint &, QwtAbstractSlider::ScrollMode &, int &direction) const
virtual double | getValue (const QPoint &)
virtual void | keyPressEvent (QKeyEvent *e)
virtual void | mouseMoveEvent (QMouseEvent *e)
double | mouseOffset () const
virtual void | mousePressEvent (QMouseEvent *e)
virtual void | mouseReleaseEvent (QMouseEvent *e)
virtual void | paintEvent (QPaintEvent *)
double | prevValue () const
virtual void | rangeChange ()
virtual void | resizeEvent (QResizeEvent *)
int | scrollMode () const
void | setMouseOffset (double)
virtual void | setPosition (const QPoint &)
virtual void | stepChange ()
virtual void | timerEvent (QTimerEvent *e)
virtual void | valueChange ()
virtual void | wheelEvent (QWheelEvent *e)

## 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 flywheel.

See also:
  The radio example.

## Member Enumeration Documentation

enum QwtAbstractSlider::ScrollMode`[inherited]`

Scroll mode

See also:
  getScrollMode()

Enumerator:

  ScrNone | Scrolling switched off. Don't change the value.
  ScrMouse | Change the value while the user keeps the button pressed and moves the mouse.
  ScrTimer | Automatic scrolling. Increment the value in the specified direction as long as the user keeps the button pressed.
  ScrPage | Automatic scrolling. Same as ScrTimer, but increment by page size.

## Constructor & Destructor Documentation

QwtWheel::QwtWheel | ( | QWidget * | parent = `NULL` | ) | `[explicit]`

Constructor.

QwtWheel::~QwtWheel | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

int QwtWheel::borderWidth | ( |  | ) | const

Returns:
  Border width

See also:
  setBorderWidth()

void QwtWheel::drawTicks | ( | QPainter * | painter,
|  | const QRectF & | rect
| ) |  | `[protected, virtual]`

Draw the Wheel's ticks

Parameters:

  painter | Painter
  rect | Rectangle for the wheel

void QwtWheel::drawWheelBackground | ( | QPainter * | painter,
|  | const QRectF & | rect
| ) |  | `[protected, virtual]`

Draw the Wheel's background gradient

Parameters:

  painter | Painter
  rect | Rectangle for the wheel

double QwtDoubleRange::exactPrevValue | ( |  | ) | const`[protected, inherited]`

Returns the exact previous value.

double QwtDoubleRange::exactValue | ( |  | ) | const`[protected, inherited]`

Returns the exact value.

The exact value is the value which QwtDoubleRange::value would return if the value were not adjusted to the step raster. It differs from the current value only if fitValue() or incValue() have been used before. This function is intended for internal use in derived classes.

void QwtAbstractSlider::fitValue | ( | double | value | ) | `[virtual, slot, inherited]`

Set the slider's value to the nearest integer multiple of the step size.

Parameters:

  value | Value

See also:
  setValue(), incValue()

Reimplemented from QwtDoubleRange.

void QwtWheel::getScrollMode | ( | const QPoint & | p,
|  | QwtAbstractSlider::ScrollMode & | scrollMode,
|  | int & | direction
| ) |  | const`[protected, virtual]`

Determine the scrolling mode and direction corresponding to a specified point.

Parameters:

  p | point
  scrollMode | scrolling mode
  direction | direction

Implements QwtAbstractSlider.

double QwtWheel::getValue | ( | const QPoint & | p | ) | `[protected, virtual]`

Determine the value corresponding to a specified point.

Implements QwtAbstractSlider.

void QwtDoubleRange::incPages | ( | int | nPages | ) | `[virtual, inherited]`

Increment the value by a specified number of pages.

Parameters:

  nPages | Number of pages to increment. A negative number decrements the value.

Warning:
  The Page size is specified in the constructor.

void QwtAbstractSlider::incValue | ( | int | steps | ) | `[virtual, slot, inherited]`

Increment the value by a specified number of steps.

Parameters:

  steps | number of steps

See also:
  setValue()

Reimplemented from QwtDoubleRange.

bool QwtAbstractSlider::isReadOnly | ( |  | ) | const`[inherited]`

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

Returns:
  true if read only

See also:
  setReadOnly()

bool QwtAbstractSlider::isValid | ( |  | ) | const`[inline, inherited]`

See also:
  QwtDblRange::isValid()

Reimplemented from QwtDoubleRange.

void QwtAbstractSlider::keyPressEvent | ( | QKeyEvent * | e | ) | `[protected, virtual, inherited]`

Handles key events

- Key_Down, KeyLeft
  Decrement by 1
- Key_Up, Key_Right
  Increment by 1

Parameters:

  e | Key event

See also:
  isReadOnly()

Reimplemented in QwtCompass, and QwtDial.

double QwtWheel::mass | ( |  | ) | const`[virtual]`

Returns:
  mass

Reimplemented from QwtAbstractSlider.

double QwtDoubleRange::maxValue | ( |  | ) | const`[inherited]`

Returns the value of the second border of the range.

maxValue returns the value which has been specified as the second parameter in QwtDoubleRange::setRange.

See also:
  setRange()

Reimplemented in QwtCounter.

QSize QwtWheel::minimumSizeHint | ( |  | ) | const`[virtual]`

Return a minimum size hint.

Warning:
  The return value is based on the wheel width.

double QwtDoubleRange::minValue | ( |  | ) | const`[inherited]`

Returns the value at the first border of the range.

minValue returns the value which has been specified as the first parameter in setRange().

See also:
  setRange()

Reimplemented in QwtCounter.

void QwtAbstractSlider::mouseMoveEvent | ( | QMouseEvent * | e | ) | `[protected, virtual, inherited]`

Mouse Move Event handler

Parameters:

  e | Mouse event

double QwtAbstractSlider::mouseOffset | ( |  | ) | const`[protected, inherited]`

See also:
  setMouseOffset()

void QwtAbstractSlider::mousePressEvent | ( | QMouseEvent * | e | ) | `[protected, virtual, inherited]`

Mouse press event handler

Parameters:

  e | Mouse event

void QwtAbstractSlider::mouseReleaseEvent | ( | QMouseEvent * | e | ) | `[protected, virtual, inherited]`

Mouse Release Event handler

Parameters:

  e | Mouse event

Qt::Orientation QwtAbstractSlider::orientation | ( |  | ) | const`[inherited]`

Returns:
  Orientation

See also:
  setOrientation()

int QwtDoubleRange::pageSize | ( |  | ) | const`[inherited]`

Returns the page size in steps.

void QwtWheel::paintEvent | ( | QPaintEvent * | event | ) | `[protected, virtual]`

Qt Paint Event.

Parameters:

  event | Paint event

bool QwtDoubleRange::periodic | ( |  | ) | const`[inherited]`

Returns true if the range is periodic.

See also:
  setPeriodic()

double QwtDoubleRange::prevValue | ( |  | ) | const`[protected, inherited]`

Returns the previous value.

void QwtDoubleRange::rangeChange | ( |  | ) | `[protected, virtual, inherited]`

Notify a change of the range.

This virtual function is called whenever the range changes. The default implementation does nothing.

Reimplemented in QwtCounter, QwtDial, and QwtSlider.

void QwtWheel::resizeEvent | ( | QResizeEvent * | event | ) | `[protected, virtual]`

Qt Resize Event.

Parameters:

  event | Resize event

int QwtAbstractSlider::scrollMode | ( |  | ) | const`[protected, inherited]`

sa ScrollMode

void QwtWheel::setBorderWidth | ( | int | width | ) |

Set the border width.

The border defaults to 2.

Parameters:

  width | Border width

See also:
  borderWidth()

void QwtWheel::setMass | ( | double | mass | ) | `[virtual]`

Set the mass of the wheel.

Assigning a mass turns the wheel into a flywheel.

Parameters:

  mass | The wheel's mass

Reimplemented from QwtAbstractSlider.

void QwtAbstractSlider::setMouseOffset | ( | double | offset | ) | `[protected, inherited]`

See also:
  mouseOffset()

void QwtWheel::setOrientation | ( | Qt::Orientation | o | ) | `[virtual]`

Set the wheel's orientation.

Parameters:

  o | Orientation. Allowed values are Qt::Horizontal and Qt::Vertical. Defaults to Qt::Horizontal.

See also:
  QwtAbstractSlider::orientation()

Reimplemented from QwtAbstractSlider.

void QwtDoubleRange::setPeriodic | ( | bool | tf | ) | `[inherited]`

Make the range periodic.

When the range is periodic, the value will be set to a point inside the interval such that

    point = value + n * width

if the user tries to set a new value which is outside the range. If the range is nonperiodic (the default), values outside the range will be clipped.

Parameters:

  tf | true for a periodic range

void QwtAbstractSlider::setPosition | ( | const QPoint & | p | ) | `[protected, virtual, inherited]`

Move the slider to a specified point, adjust the value and emit signals if necessary.

void QwtDoubleRange::setRange | ( | double | vmin,
|  | double | vmax,
|  | double | vstep = `0.0`,
|  | int | pageSize = `1`
| ) |  | `[inherited]`

Specify range and step size.

Parameters:

  vmin | lower boundary of the interval
  vmax | higher boundary of the interval
  vstep | step width
  pageSize | page size in steps

Warning:
  - A change of the range changes the value if it lies outside the new range. The current value will *not* be adjusted to the new step raster.
  - vmax < vmin is allowed.
  - If the step size is left out or set to zero, it will be set to 1/100 of the interval length.
  - If the step size has an absurd value, it will be corrected to a better one.

void QwtAbstractSlider::setReadOnly | ( | bool | readOnly | ) | `[virtual, slot, inherited]`

En/Disable read only mode

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

Parameters:

  readOnly | Enables in case of true

See also:
  isReadOnly()

void QwtDoubleRange::setStep | ( | double | vstep | ) | `[inherited]`

Change the step raster.

Parameters:

  vstep | new step width

Warning:
  The value will not be adjusted to the new step raster.

Reimplemented in QwtCounter.

void QwtWheel::setTickCnt | ( | int | cnt | ) |

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

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

Parameters:

  cnt | Number of grooves per 360 degrees

See also:
  tickCnt()

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:

  angle | total angle in degrees

See also:
  totalAngle()

void QwtAbstractSlider::setTracking | ( | bool | enable | ) | `[inherited]`

Enables or disables tracking.

If tracking is enabled, the slider emits a valueChanged() signal whenever its value changes (the default behaviour). If tracking is disabled, the value changed() signal will only be emitted if:

- the user releases the mouse button and the value has changed or
- at the end of automatic scrolling.

Tracking is enabled by default.

Parameters:

  enable | `true` (enable) or `false` (disable) tracking.

void QwtAbstractSlider::setUpdateTime | ( | int | t | ) | `[inherited]`

Specify the update interval for automatic scrolling.

Parameters:

  t | update interval in milliseconds

See also:
  getScrollMode()

void QwtAbstractSlider::setValid | ( | bool | valid | ) | `[inline, inherited]`

Parameters:

  valid | true/false

See also:
  QwtDblRange::isValid()

Reimplemented from QwtDoubleRange.

void QwtAbstractSlider::setValue | ( | double | val | ) | `[virtual, slot, inherited]`

Move the slider to a specified value.

This function can be used to move the slider to a value which is not an integer multiple of the step size.

Parameters:

  val | new value

See also:
  fitValue()

Reimplemented from QwtDoubleRange.

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:

  angle | Visible angle in degrees

See also:
  viewAngle(), setTotalAngle()

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:

  borderWidth | Border width

See also:
  internalBorder()

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:

  width | the wheel's width

See also:
  wheelWidth()

QSize QwtWheel::sizeHint | ( |  | ) | const`[virtual]`

Returns:
  a size hint

void QwtAbstractSlider::sliderMoved | ( | double | value | ) | `[signal, inherited]`

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

Parameters:

  value | new value

void QwtAbstractSlider::sliderPressed | ( |  | ) | `[signal, inherited]`

This signal is emitted when the user presses the movable part of the slider (start ScrMouse Mode).

void QwtAbstractSlider::sliderReleased | ( |  | ) | `[signal, inherited]`

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

double QwtDoubleRange::step | ( |  | ) | const`[inherited]`

Returns:
  the step size

See also:
  setStep(), setRange()

Reimplemented in QwtCounter.

void QwtDoubleRange::stepChange | ( |  | ) | `[protected, virtual, inherited]`

Notify a change of the step size.

This virtual function is called whenever the step size changes. The default implementation does nothing.

void QwtAbstractSlider::stopMoving | ( |  | ) | `[inherited]`

Stop updating if automatic scrolling is active.

int QwtWheel::tickCnt | ( |  | ) | const

Returns:
  Number of grooves in the wheel's surface.

See also:
  setTickCnt()

void QwtAbstractSlider::timerEvent | ( | QTimerEvent * | e | ) | `[protected, virtual, inherited]`

Qt timer event

Parameters:

  e | Timer event

double QwtWheel::totalAngle | ( |  | ) | const

Returns:
  Total angle which the wheel can be turned.

See also:
  setTotalAngle()

double QwtDoubleRange::value | ( |  | ) | const`[inherited]`

Returns the current value.

Reimplemented in QwtCounter.

void QwtWheel::valueChange | ( |  | ) | `[protected, virtual]`

Notify value change.

Reimplemented from QwtAbstractSlider.

void QwtAbstractSlider::valueChanged | ( | double | value | ) | `[signal, inherited]`

Notify a change of value.

In the default setting (tracking enabled), this signal will be emitted every time the value changes ( see setTracking() ).

Parameters:

  value | new value

double QwtWheel::viewAngle | ( |  | ) | const

Returns:
  Visible portion of the wheel

See also:
  setViewAngle(), totalAngle()

int QwtWheel::wheelBorderWidth | ( |  | ) | const

Returns:
  Wheel border width

See also:
  setWheelBorderWidth()

void QwtAbstractSlider::wheelEvent | ( | QWheelEvent * | e | ) | `[protected, virtual, inherited]`

Wheel Event handler

Parameters:

  e | Whell event

QRect QwtWheel::wheelRect | ( |  | ) | const

Returns:
  Rectangle of the wheel without the outer border

int QwtWheel::wheelWidth | ( |  | ) | const

Returns:
  Width of the wheel

See also:
  setWheelWidth()