QwtKnob - Man Page

Name

QwtKnob ā€”

The Knob Widget. Ā 

Synopsis

#include <qwt_knob.h>

Inherits QwtAbstractSlider, and QwtAbstractScale.

Public Types

enum ScrollMode { ScrNone, ScrMouse, ScrTimer, ScrDirect, ScrPage }
enum Symbol { Line, Dot }

Public Slots

virtual void fitValue (double val)
virtual void incValue (int steps)
virtual void setReadOnly (bool)
virtual void setValue (double val)

Signals

void sliderMoved (double value)
void sliderPressed ()
void sliderReleased ()
void valueChanged (double value)

Public Member Functions

bool autoScale () const
int borderWidth () const
virtual void incPages (int)
bool isReadOnly () const
bool isValid () const
int knobWidth () const
virtual double mass () const
double maxValue () const
virtual QSize minimumSizeHint () const
double minValue () const
Qt::Orientation orientation () const
int pageSize () const
bool periodic () const
QwtKnob (QWidget *parent=NULL)
const QwtRoundScaleDraw * scaleDraw () const
QwtRoundScaleDraw * scaleDraw ()
QwtScaleEngine * scaleEngine ()
const QwtScaleEngine * scaleEngine () const
const QwtScaleMap & scaleMap () const
int scaleMaxMajor () const
int scaleMaxMinor () const
void setAutoScale ()
void setBorderWidth (int bw)
void setKnobWidth (int w)
virtual void setMass (double val)
virtual void setOrientation (Qt::Orientation o)
void setPeriodic (bool tf)
void setRange (double vmin, double vmax, double vstep=0.0, int pagesize=1)
void setScale (const QwtScaleDiv &s)
void setScale (double vmin, double vmax, double step=0.0)
void setScale (const QwtDoubleInterval &, double step=0.0)
void setScaleDraw (QwtRoundScaleDraw *)
void setScaleEngine (QwtScaleEngine *)
void setScaleMaxMajor (int ticks)
void setScaleMaxMinor (int ticks)
void setStep (double)
void setSymbol (Symbol)
void setTotalAngle (double angle)
void setTracking (bool enable)
void setUpdateTime (int t)
void setValid (bool valid)
virtual QSize sizeHint () const
double step () const
void stopMoving ()
Symbol symbol () const
double totalAngle () const
double value () const
virtual ~QwtKnob ()

Protected Member Functions

const QwtAbstractScaleDraw * abstractScaleDraw () const
QwtAbstractScaleDraw * abstractScaleDraw ()
void draw (QPainter *p, const QRect &ur)
void drawKnob (QPainter *p, const QRect &r)
void drawMarker (QPainter *p, double arc, const QColor &c)
double exactPrevValue () const
double exactValue () const
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 *e)
double prevValue () const
void rescale (double vmin, double vmax, double step=0.0)
virtual void resizeEvent (QResizeEvent *e)
int scrollMode () const
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
void setMouseOffset (double)
virtual void setPosition (const QPoint &)
virtual void stepChange ()
virtual void timerEvent (QTimerEvent *e)
virtual void wheelEvent (QWheelEvent *e)

Detailed Description

The Knob Widget.

The QwtKnob widget imitates look and behaviour of a volume knob on a radio. It contains a scale around the knob which is set up automatically or can be configured manually (see QwtAbstractScale). Automatic scrolling is enabled when the user presses a mouse button on the scale. For a description of signals, slots and other members, see QwtAbstractSlider.

See also:

QwtAbstractSlider and QwtAbstractScale for the descriptions of the inherited members.

Member Enumeration Documentation

enum QwtAbstractSlider::ScrollMode [inherited] Scroll mode

See also:

getScrollMode()

enum QwtKnob::Symbol Symbol

See also:

QwtKnob::QwtKnob()

Constructor & Destructor Documentation

QwtKnob::QwtKnob (QWidget *parent = NULL) [explicit] Constructor

Parameters:

parent Parent widget

QwtKnob::~QwtKnob () [virtual]

Destructor.

Member Function Documentation

const QwtAbstractScaleDraw * QwtAbstractScale::abstractScaleDraw () const [protected, inherited] Returns

Scale draw

See also:

setAbstractScaleDraw()

QwtAbstractScaleDraw * QwtAbstractScale::abstractScaleDraw () [protected, inherited] Returns

Scale draw

See also:

setAbstractScaleDraw()

bool QwtAbstractScale::autoScale () const [inherited] Returns

true if autoscaling is enabled

int QwtKnob::borderWidth () const

Return the border width.

void QwtKnob::draw (QPainter *painter, const QRect &rect) [protected] Repaint the knob

Parameters:

painter Painter
rect Update rectangle

void QwtKnob::drawKnob (QPainter *painter, const QRect &r) [protected]

Draw the knob. Parameters:

painter painter
r Bounding rectangle of the knob (without scale)

void QwtKnob::drawMarker (QPainter *p, doublearc, const QColor &c) [protected]

Draw the marker at the knob's front. Parameters:

p Painter
arc Angle of the marker
c Marker color

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 QwtDoubleRange::fitValue or QwtDoubleRange::incValue have been used before. This function is intended for internal use in derived classes.

void QwtAbstractSlider::fitValue (doublevalue) [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 QwtDoubleRange::incPages (intnPages) [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 (intsteps) [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.

int QwtKnob::knobWidth () const

Return the width of the knob.

double QwtAbstractSlider::mass () const [virtual, inherited] Returns

mass

See also:

setMass()

Reimplemented in QwtWheel.

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

QSize QwtKnob::minimumSizeHint () const [virtual]

Return a minimum size hint. Warning:

The return value of QwtKnob::minimumSizeHint() depends on the font and the scale.

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

void QwtAbstractSlider::mouseMoveEvent (QMouseEvent *e) [protected, virtual, inherited] Mouse Move Event handler

Parameters:

e Mouse event

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 QwtKnob::paintEvent (QPaintEvent *e) [protected, virtual] Repaint the knob

Parameters:

e 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 QwtAbstractScale::rescale (doublevmin, doublevmax, doublestepSize = 0.0) [protected, inherited] Recalculate the scale division and update the scale draw.

Parameters:

vmin Lower limit of the scale interval
vmax Upper limit of the scale interval
stepSize Major step size

See also:

scaleChange()

void QwtKnob::resizeEvent (QResizeEvent *e) [protected, virtual] Qt Resize Event

const QwtRoundScaleDraw * QwtKnob::scaleDraw () const Returns

the scale draw of the knob

See also:

setScaleDraw()

QwtRoundScaleDraw * QwtKnob::scaleDraw () Returns

the scale draw of the knob

See also:

setScaleDraw()

const QwtScaleEngine * QwtAbstractScale::scaleEngine () const [inherited] Returns

Scale engine

See also:

setScaleEngine()

QwtScaleEngine * QwtAbstractScale::scaleEngine () [inherited] Returns

Scale engine

See also:

setScaleEngine()

const QwtScaleMap & QwtAbstractScale::scaleMap () const [inherited] Returns

abstractScaleDraw()->scaleMap()

int QwtAbstractScale::scaleMaxMajor () const [inherited] Returns

Max. number of major tick intervals The default value is 5.

int QwtAbstractScale::scaleMaxMinor () const [inherited] Returns

Max. number of minor tick intervals The default value is 3.

void QwtAbstractScale::setAbstractScaleDraw (QwtAbstractScaleDraw *scaleDraw) [protected, inherited]

Set a scale draw. scaleDraw has to be created with new and will be deleted in ~QwtAbstractScale or the next call of setAbstractScaleDraw.

void QwtAbstractScale::setAutoScale () [inherited]

Advise the widget to control the scale range internally. Autoscaling is on by default.

See also:

setScale(), autoScale()

void QwtKnob::setBorderWidth (intbw)

Set the knob's border width. Parameters:

bw new border width

void QwtKnob::setKnobWidth (intw)

Change the knob's width. The specified width must be >= 5, or it will be clipped.

Parameters:

w New width

void QwtAbstractSlider::setMass (doubleval) [virtual, inherited]

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:

val New mass in kg

See also:

mass()

Reimplemented in QwtWheel.

void QwtAbstractSlider::setOrientation (Qt::Orientationo) [virtual, inherited]

Set the orientation. Parameters:

o Orientation. Allowed values are Qt::Horizontal and Qt::Vertical.

Reimplemented in QwtSlider, and QwtWheel.

void QwtDoubleRange::setPeriodic (booltf) [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 .fi


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 (doublevmin, doublevmax, doublevstep = 0.0, intpageSize = 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 (boolreadOnly) [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 QwtAbstractScale::setScale (const QwtScaleDiv &scaleDiv) [inherited]

Specify a scale. Disable autoscaling and define a scale by a scale division

Parameters:

scaleDiv Scale division

See also:

setAutoScale()

void QwtAbstractScale::setScale (doublevmin, doublevmax, doublestepSize = 0.0) [inherited]

Specify a scale. Disable autoscaling and define a scale by an interval and a step size

Parameters:

vmin lower limit of the scale interval
vmax upper limit of the scale interval
stepSize major step size

See also:

setAutoScale()

void QwtAbstractScale::setScale (const QwtDoubleInterval &interval, doublestepSize = 0.0) [inherited]

Specify a scale. Disable autoscaling and define a scale by an interval and a step size

Parameters:

interval Interval
stepSize major step size

See also:

setAutoScale()

void QwtKnob::setScaleDraw (QwtRoundScaleDraw *scaleDraw) Change the scale draw of the knob

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

See also:

scaleDraw()

void QwtAbstractScale::setScaleEngine (QwtScaleEngine *scaleEngine) [inherited]

Set a scale engine. The scale engine is responsible for calculating the scale division, and in case of auto scaling how to align the scale.

scaleEngine has to be created with new and will be deleted in ~QwtAbstractScale or the next call of setScaleEngine.

void QwtAbstractScale::setScaleMaxMajor (intticks) [inherited]

Set the maximum number of major tick intervals. The scale's major ticks are calculated automatically such that the number of major intervals does not exceed ticks. The default value is 5.

Parameters:

ticks maximal number of major ticks.

See also:

QwtAbstractScaleDraw

void QwtAbstractScale::setScaleMaxMinor (intticks) [inherited]

Set the maximum number of minor tick intervals. The scale's minor ticks are calculated automatically such that the number of minor intervals does not exceed ticks. The default value is 3.

Parameters:

ticks

See also:

QwtAbstractScaleDraw

void QwtDoubleRange::setStep (doublevstep) [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 QwtKnob::setSymbol (QwtKnob::Symbols)

Set the symbol of the knob. See also:

symbol()

void QwtKnob::setTotalAngle (doubleangle)

Set the total angle by which the knob can be turned. Parameters:

angle Angle in degrees.

The default angle is 270 degrees. It is possible to specify an angle of more than 360 degrees so that the knob can be turned several times around its axis.

void QwtAbstractSlider::setTracking (boolenable) [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 (intt) [inherited]

Specify the update interval for automatic scrolling. Parameters:

t update interval in milliseconds

See also:

getScrollMode()

void QwtAbstractSlider::setValid (boolvalid) [inline, inherited] Parameters

valid true/false

See also:

QwtDblRange::isValid()

Reimplemented from QwtDoubleRange.

void QwtAbstractSlider::setValue (doubleval) [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.

QSize QwtKnob::sizeHint () const [virtual] Returns

minimumSizeHint()

void QwtAbstractSlider::sliderMoved (doublevalue) [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.

QwtKnob::Symbol QwtKnob::symbol () const Returns

symbol of the knob

See also:

setSymbol()

void QwtAbstractSlider::timerEvent (QTimerEvent *e) [protected, virtual, inherited] Qt timer event

Parameters:

e Timer event

double QwtKnob::totalAngle () const

Return the total angle.

double QwtDoubleRange::value () const [inherited]

Returns the current value.

Reimplemented in QwtCounter.

void QwtAbstractSlider::valueChanged (doublevalue) [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

void QwtAbstractSlider::wheelEvent (QWheelEvent *e) [protected, virtual, inherited] Wheel Event handler

Parameters:

e Whell event

Author

Generated automatically by Doxygen for Qwt User's Guide from the source code.

Info

Mon Aug 1 2011 Version 5.2.2 Qwt User's Guide