Scroll to navigation

QwtDial(3) Qwt User's Guide QwtDial(3)

NAME

QwtDial -

SYNOPSIS

#include <qwt_dial.h>

Inherits QwtAbstractSlider.

Inherited by QwtAnalogClock, and QwtCompass.

Public Types


enum Direction { Clockwise, CounterClockwise }
enum Mode { RotateNeedle, RotateScale }
enum ScaleOptions { ScaleBackbone = 1, ScaleTicks = 2, ScaleLabel = 4 }
enum Shadow { Plain = QFrame::Plain, Raised = QFrame::Raised, Sunken = QFrame::Sunken }

Public Member Functions


QwtDial (QWidget *parent=NULL)
virtual ~QwtDial ()
QRect boundingRect () const
QRect contentsRect () const
Direction direction () const
Shadow frameShadow () const
bool hasVisibleBackground () const
int lineWidth () const
double maxScaleArc () const
virtual QSize minimumSizeHint () const
double minScaleArc () const
Mode mode () const
const QwtDialNeedle * needle () const
QwtDialNeedle * needle ()
double origin () const
virtual QRect scaleContentsRect () const
QwtDialScaleDraw * scaleDraw ()
const QwtDialScaleDraw * scaleDraw () const
void setDirection (Direction)
void setFrameShadow (Shadow)
void setLineWidth (int)
void setMode (Mode)
virtual void setNeedle (QwtDialNeedle *)
virtual void setOrigin (double)
virtual void setScale (int maxMajIntv, int maxMinIntv, double step=0.0)
void setScaleArc (double min, double max)
virtual void setScaleDraw (QwtDialScaleDraw *)
void setScaleOptions (int)
void setScaleTicks (int minLen, int medLen, int majLen, int penWidth=1)
virtual void setWrapping (bool)
void showBackground (bool)
virtual QSize sizeHint () const
bool wrapping () const

Protected Member Functions


virtual void drawContents (QPainter *) const
virtual void drawFocusIndicator (QPainter *) const
virtual void drawFrame (QPainter *p)
virtual void drawNeedle (QPainter *, const QPoint &, int radius, double direction, QPalette::ColorGroup) const
virtual void drawScale (QPainter *, const QPoint &center, int radius, double origin, double arcMin, double arcMax) const
virtual void drawScaleContents (QPainter *painter, const QPoint &center, int radius) const
virtual void getScrollMode (const QPoint &, int &scrollMode, int &direction)
virtual double getValue (const QPoint &)
virtual void keyPressEvent (QKeyEvent *)
virtual void paintEvent (QPaintEvent *)
virtual void rangeChange ()
virtual void resizeEvent (QResizeEvent *)
virtual QwtText scaleLabel (double) const
virtual void updateMask ()
void updateScale ()
virtual void valueChange ()

Friends


class QwtDialScaleDraw

Additional Inherited Members

Detailed Description

QwtDial class provides a rounded range control.

QwtDial is intended as base class for dial widgets like speedometers, compass widgets, clocks ...

A dial contains a scale and a needle indicating the current value of the dial. Depending on Mode one of them is fixed and the other is rotating. If not isReadOnly() the dial can be rotated by dragging the mouse or using keyboard inputs (see keyPressEvent()). A dial might be wrapping, what means a rotation below/above one limit continues on the other limit (f.e compass). The scale might cover any arc of the dial, its values are related to the origin() of the dial.

Qwt is missing a set of good looking needles (QwtDialNeedle). Contributions are very welcome.

See also:

QwtCompass, QwtAnalogClock, QwtDialNeedle

Note:

The examples/dials example shows different types of dials.

Member Enumeration Documentation

enum QwtDial::Direction

Direction of the dial

enum QwtDial::Mode

In case of RotateNeedle the needle is rotating, in case of RotateScale, the needle points to origin() and the scale is rotating.

enum QwtDial::Shadow

Frame shadow. Unfortunately it is not possible to use QFrame::Shadow as a property of a widget that is not derived from QFrame. The following enum is made for the designer only. It is safe to use QFrame::Shadow instead.

Constructor & Destructor Documentation

QwtDial::QwtDial (QWidget *parent = NULL) [explicit]

Constructor. Parameters:

parent Parent widget

Create a dial widget with no scale and no needle. The default origin is 90.0 with no valid value. It accepts mouse and keyboard inputs and has no step size. The default mode is QwtDial::RotateNeedle.

Member Function Documentation

QRect QwtDial::boundingRect () const

Returns:

bounding rect of the dial including the frame

See also:

setLineWidth(), scaleContentsRect(), contentsRect()

QRect QwtDial::contentsRect () const

Returns:

bounding rect of the circle inside the frame

See also:

setLineWidth(), scaleContentsRect(), boundingRect()

QwtDial::Direction QwtDial::direction () const

Returns:

Direction of the dial

The default direction of a dial is QwtDial::Clockwise

See also:

setDirection()

void QwtDial::drawContents (QPainter *painter) const [protected], [virtual]

Draw the contents inside the frame. QColorGroup::Background is the background color outside of the frame. QColorGroup::Base is the background color inside the frame. QColorGroup::Foreground is the background color inside the scale.

Parameters:

painter Painter

See also:

boundingRect(), contentsRect(), scaleContentsRect(), QWidget::setPalette()

void QwtDial::drawFocusIndicator (QPainter *painter) const [protected], [virtual]

Draw a dotted round circle, if !isReadOnly()

Parameters:

painter Painter

void QwtDial::drawFrame (QPainter *painter) [protected], [virtual]

Draw the frame around the dial

Parameters:

painter Painter

See also:

lineWidth(), frameShadow()

void QwtDial::drawNeedle (QPainter *painter, const QPoint &center, intradius, doubledirection, QPalette::ColorGroupcg) const [protected], [virtual]

Draw the needle

Parameters:

painter Painter
center Center of the dial
radius Length for the needle
direction Direction of the needle in degrees, counter clockwise
cg ColorGroup

Reimplemented in QwtAnalogClock.

void QwtDial::drawScale (QPainter *painter, const QPoint &center, intradius, doubleorigin, doubleminArc, doublemaxArc) const [protected], [virtual]

Draw the scale

Parameters:

painter Painter
center Center of the dial
radius Radius of the scale
origin Origin of the scale
minArc Minimum of the arc
maxArc Minimum of the arc

See also:

QwtAbstractScaleDraw::setAngleRange()

void QwtDial::drawScaleContents (QPainter *painter, const QPoint &center, intradius) const [protected], [virtual]

Draw the contents inside the scale

Paints nothing.

Parameters:

painter Painter
center Center of the contents circle
radius Radius of the contents circle

Reimplemented in QwtCompass.

QwtDial::Shadow QwtDial::frameShadow () const

Returns:

Frame shadow /sa setFrameShadow(), lineWidth(), QFrame::frameShadow

void QwtDial::getScrollMode (const QPoint &pos, int &scrollMode, int &direction) [protected], [virtual]

See QwtAbstractSlider::getScrollMode()

Parameters:

pos point where the mouse was pressed

Return values:

scrollMode The scrolling mode
direction direction: 1, 0, or -1.

See also:

QwtAbstractSlider::getScrollMode()

Implements QwtAbstractSlider.

double QwtDial::getValue (const QPoint &pos) [protected], [virtual]

Find the value for a given position

Parameters:

pos Position

Returns:

Value

Implements QwtAbstractSlider.

bool QwtDial::hasVisibleBackground () const

true when the area outside of the frame is visible

See also:

showBackground(), setMask()

void QwtDial::keyPressEvent (QKeyEvent *event) [protected], [virtual]

Handles key events

  • Key_Down, KeyLeft
    Decrement by 1
  • Key_Prior
    Decrement by pageSize()
  • Key_Home
    Set the value to minValue()
  • Key_Up, KeyRight
    Increment by 1
  • Key_Next
    Increment by pageSize()
  • Key_End
    Set the value to maxValue()

Parameters:

event Key event

See also:

isReadOnly()

Reimplemented from QwtAbstractSlider.

Reimplemented in QwtCompass.

int QwtDial::lineWidth () const

Returns:

Line width of the frame

See also:

setLineWidth(), frameShadow(), lineWidth()

double QwtDial::maxScaleArc () const

Returns:

Upper limit of the scale arc

QSize QwtDial::minimumSizeHint () const [virtual]

Return a minimum size hint. Warning:

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

double QwtDial::minScaleArc () const

Returns:

Lower limit of the scale arc

QwtDial::Mode QwtDial::mode () const

Returns:

mode of the dial.

The value of the dial is indicated by the difference between the origin and the direction of the needle. In case of QwtDial::RotateNeedle the scale arc is fixed to the origin() and the needle is rotating, in case of QwtDial::RotateScale, the needle points to origin() and the scale is rotating.

The default mode is QwtDial::RotateNeedle.

See also:

setMode(), origin(), setScaleArc(), value()

const QwtDialNeedle * QwtDial::needle () const

Returns:

needle

See also:

setNeedle()

QwtDialNeedle * QwtDial::needle ()

Returns:

needle

See also:

setNeedle()

double QwtDial::origin () const

The origin is the angle where scale and needle is relative to.

Returns:

Origin of the dial

See also:

setOrigin()

void QwtDial::paintEvent (QPaintEvent *e) [protected], [virtual]

Paint the dial

Parameters:

e Paint event

void QwtDial::resizeEvent (QResizeEvent *e) [protected], [virtual]

Resize the dial widget

Parameters:

e Resize event

QRect QwtDial::scaleContentsRect () const [virtual]

Returns:

rect inside the scale

See also:

setLineWidth(), boundingRect(), contentsRect()

QwtText QwtDial::scaleLabel (doublevalue) const [protected], [virtual]

Find the label for a value

Parameters:

value Value

Returns:

label

Reimplemented in QwtAnalogClock, and QwtCompass.

void QwtDial::setDirection (Directiondirection)

Set the direction of the dial (clockwise/counterclockwise)

Direction direction

See also:

direction()

void QwtDial::setFrameShadow (Shadowshadow)

Sets the frame shadow value from the frame style.

Parameters:

shadow Frame shadow

See also:

setLineWidth(), QFrame::setFrameShadow()

void QwtDial::setLineWidth (intlineWidth)

Sets the line width

Parameters:

lineWidth Line width

See also:

setFrameShadow()

void QwtDial::setMode (Modemode)

Change the mode of the meter. Parameters:

mode New mode

The value of the meter is indicated by the difference between north of the scale and the direction of the needle. In case of QwtDial::RotateNeedle north is pointing to the origin() and the needle is rotating, in case of QwtDial::RotateScale, the needle points to origin() and the scale is rotating.

The default mode is QwtDial::RotateNeedle.

See also:

mode(), setValue(), setOrigin()

void QwtDial::setNeedle (QwtDialNeedle *needle) [virtual]

Set a needle for the dial

Qwt is missing a set of good looking needles. Contributions are very welcome.

Parameters:

needle Needle

Warning:

The needle will be deleted, when a different needle is set or in ~QwtDial()

void QwtDial::setOrigin (doubleorigin) [virtual]

Change the origin. The origin is the angle where scale and needle is relative to.

Parameters:

origin New origin

See also:

origin()

void QwtDial::setScale (intmaxMajIntv, intmaxMinIntv, doublestep = 0.0) [virtual]

Change the intervals of the scale

See also:

QwtAbstractScaleDraw::setScale()

void QwtDial::setScaleArc (doubleminArc, doublemaxArc)

Change the arc of the scale

Parameters:

minArc Lower limit
maxArc Upper limit

void QwtDial::setScaleDraw (QwtDialScaleDraw *scaleDraw) [virtual]

Set an individual scale draw

Parameters:

scaleDraw Scale draw

Warning:

The previous scale draw is deleted

void QwtDial::setScaleOptions (intoptions)

A wrapper method for accessing the scale draw.

  • options == 0
    No visible scale: setScaleDraw(NULL)
  • options & ScaleBackbone
    En/disable the backbone of the scale.
  • options & ScaleTicks
    En/disable the ticks of the scale.
  • options & ScaleLabel
    En/disable scale labels

See also:

QwtAbstractScaleDraw::enableComponent()

void QwtDial::setScaleTicks (intminLen, intmedLen, intmajLen, intpenWidth = 1)

Assign length and width of the ticks

Parameters:

minLen Length of the minor ticks
medLen Length of the medium ticks
majLen Length of the major ticks
penWidth Width of the pen for all ticks

See also:

QwtAbstractScaleDraw::setTickLength(), QwtDialScaleDraw::setPenWidth()

void QwtDial::setWrapping (boolwrapping) [virtual]

Sets whether it is possible to step the value from the highest value to the lowest value and vice versa to on.

Parameters:

wrapping en/disables wrapping

See also:

wrapping(), QwtDoubleRange::periodic()

Note:

The meaning of wrapping is like the wrapping property of QSpinBox, but not like it is used in QDial.

void QwtDial::showBackground (boolshow)

Show/Hide the area outside of the frame

Parameters:

show Show if true, hide if false

See also:

hasVisibleBackground(), setMask()

Warning:

When QwtDial is a toplevel widget the window border might disappear too.

QSize QwtDial::sizeHint () const [virtual]

Returns:

Size hint

void QwtDial::updateMask () [protected], [virtual]

Update the mask of the dial. In case of 'hasVisibleBackground() == false', the backgound is transparent by a mask.

See also:

showBackground(), hasVisibleBackground()

void QwtDial::updateScale () [protected]

Update the scale with the current attributes

See also:

setScale()

bool QwtDial::wrapping () const

wrapping() holds whether it is possible to step the value from the highest value to the lowest value and vice versa.

See also:

setWrapping(), QwtDoubleRange::setPeriodic()

Note:

The meaning of wrapping is like the wrapping property of QSpinBox, but not like it is used in QDial.

Author

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

Tue Nov 20 2012 Version 5.2.3