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.
Definition at line 67 of file qwt_dial.h.
Public Types | |
enum | Shadow { Plain = QFrame::Plain, Raised = QFrame::Raised, Sunken = QFrame::Sunken } |
enum | ScaleOptions { ScaleBackbone = 1, ScaleTicks = 2, ScaleLabel = 4 } |
enum | Mode { RotateNeedle, RotateScale } |
Public Member Functions | |
QwtDial (QWidget *parent=NULL) | |
virtual | ~QwtDial () |
void | setFrameShadow (Shadow) |
Shadow | frameShadow () const |
bool | hasVisibleBackground () const |
void | showBackground (bool) |
void | setLineWidth (int) |
int | lineWidth () const |
void | setMode (Mode) |
Mode | mode () const |
virtual void | setWrapping (bool) |
bool | wrapping () const |
virtual void | setScale (int maxMajIntv, int maxMinIntv, double step=0.0) |
void | setScaleArc (double min, double max) |
void | setScaleOptions (int) |
void | setScaleTicks (int minLen, int medLen, int majLen, int penWidth=1) |
double | minScaleArc () const |
double | maxScaleArc () const |
virtual void | setOrigin (double) |
double | origin () const |
virtual void | setNeedle (QwtDialNeedle *) |
const QwtDialNeedle * | needle () const |
QwtDialNeedle * | needle () |
QRect | boundingRect () const |
QRect | contentsRect () const |
virtual QRect | scaleContentsRect () const |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
virtual void | setScaleDraw (QwtDialScaleDraw *) |
QwtDialScaleDraw * | scaleDraw () |
const QwtDialScaleDraw * | scaleDraw () const |
Protected Member Functions | |
virtual void | paintEvent (QPaintEvent *) |
virtual void | resizeEvent (QResizeEvent *) |
virtual void | keyPressEvent (QKeyEvent *) |
virtual void | updateMask () |
virtual void | drawFrame (QPainter *p) |
virtual void | drawContents (QPainter *) const |
virtual void | drawFocusIndicator (QPainter *) const |
virtual void | drawScale (QPainter *, const QPoint ¢er, int radius, double origin, double arcMin, double arcMax) const |
virtual void | drawScaleContents (QPainter *painter, const QPoint ¢er, int radius) const |
virtual void | drawNeedle (QPainter *, const QPoint &, int radius, double direction, QPalette::ColorGroup) const |
virtual QwtText | scaleLabel (double) const |
void | updateScale () |
virtual void | rangeChange () |
virtual void | valueChange () |
virtual double | getValue (const QPoint &) |
virtual void | getScrollMode (const QPoint &, int &scrollMode, int &direction) |
Friends | |
class | QwtDialScaleDraw |
|
In case of RotateNeedle the needle is rotating, in case of RotateScale, the needle points to origin() and the scale is rotating. Definition at line 112 of file qwt_dial.h. |
|
Definition at line 100 of file qwt_dial.h. |
|
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. Definition at line 92 of file qwt_dial.h. |
|
Constructor.
Definition at line 143 of file qwt_dial.cpp. |
|
Destructor.
Definition at line 207 of file qwt_dial.cpp. |
|
Definition at line 311 of file qwt_dial.cpp. Referenced by contentsRect(), drawContents(), drawFrame(), and updateMask(). |
|
Definition at line 294 of file qwt_dial.cpp. References boundingRect(), and lineWidth(). Referenced by drawFocusIndicator(), getScrollMode(), and scaleContentsRect(). |
|
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.
Definition at line 572 of file qwt_dial.cpp. References boundingRect(), drawNeedle(), drawScale(), drawScaleContents(), QwtAbstractSlider::isValid(), QwtDoubleRange::maxValue(), QwtDoubleRange::minValue(), mode(), origin(), scaleContentsRect(), and QwtDoubleRange::value(). Referenced by paintEvent(). |
|
Draw a dotted round circle, if !isReadOnly()
Definition at line 463 of file qwt_dial.cpp. References contentsRect(), and QwtAbstractSlider::isReadOnly(). Referenced by paintEvent(). |
|
Draw the frame around the dial
Definition at line 510 of file qwt_dial.cpp. References boundingRect(), QwtPainter::drawRoundFrame(), and lineWidth(). Referenced by paintEvent(). |
|
Draw the needle
Reimplemented in QwtAnalogClock. Definition at line 682 of file qwt_dial.cpp. Referenced by drawContents(). |
|
Draw the scale
Definition at line 704 of file qwt_dial.cpp. Referenced by drawContents(). |
|
Draw the contents inside the scale Paints nothing.
Reimplemented in QwtCompass. Definition at line 755 of file qwt_dial.cpp. Referenced by drawContents(). |
|
Definition at line 258 of file qwt_dial.cpp. |
|
Implements QwtAbstractSlider. Definition at line 1155 of file qwt_dial.cpp. References contentsRect(). |
|
Find the value for a given position
Implements QwtAbstractSlider. Definition at line 1052 of file qwt_dial.cpp. References QwtDoubleRange::maxValue(), QwtDoubleRange::minValue(), mode(), QwtAbstractSlider::mouseOffset(), QwtAbstractSlider::scrollMode(), QwtAbstractSlider::setMouseOffset(), QwtDoubleRange::value(), and wrapping(). |
|
true when the area outside of the frame is visible
Definition at line 234 of file qwt_dial.cpp. Referenced by resizeEvent(). |
|
Handles key events
Reimplemented from QwtAbstractSlider. Reimplemented in QwtCompass. Definition at line 1187 of file qwt_dial.cpp. References QwtDoubleRange::incValue(), QwtAbstractSlider::isReadOnly(), QwtAbstractSlider::isValid(), QwtDoubleRange::maxValue(), QwtDoubleRange::minValue(), QwtDoubleRange::pageSize(), QwtDoubleRange::prevValue(), and QwtAbstractSlider::setValue(). |
|
Definition at line 285 of file qwt_dial.cpp. Referenced by contentsRect(), drawFrame(), minimumSizeHint(), setFrameShadow(), and sizeHint(). |
|
Definition at line 940 of file qwt_dial.cpp. |
|
Return a minimum size hint.
Definition at line 1017 of file qwt_dial.cpp. References lineWidth(). |
|
Definition at line 934 of file qwt_dial.cpp. |
|
The default mode is QwtDial::RotateNeedle.
Definition at line 382 of file qwt_dial.cpp. Referenced by drawContents(), QwtCompass::drawScaleContents(), and getValue(). |
|
Definition at line 796 of file qwt_dial.cpp. |
|
Definition at line 787 of file qwt_dial.cpp. Referenced by QwtAnalogClock::drawHand(), QwtAnalogClock::setHand(), and setNeedle(). |
|
The origin is the angle where scale and needle is relative to.
Definition at line 965 of file qwt_dial.cpp. Referenced by drawContents(), QwtAnalogClock::drawNeedle(), and QwtCompass::drawScaleContents(). |
|
Paint the dial
Definition at line 431 of file qwt_dial.cpp. References drawContents(), drawFocusIndicator(), and drawFrame(). |
|
QwtDoubleRange update hook.
Reimplemented from QwtDoubleRange. Definition at line 802 of file qwt_dial.cpp. References updateScale(). |
|
Resize the dial widget
Definition at line 419 of file qwt_dial.cpp. References hasVisibleBackground(), and updateMask(). |
|
Definition at line 324 of file qwt_dial.cpp. References contentsRect(). Referenced by drawContents(). |
|
Return the scale draw.
Definition at line 833 of file qwt_dial.cpp. |
|
Return the scale draw.
Definition at line 827 of file qwt_dial.cpp. Referenced by setScaleDraw(). |
|
Find the label for a value
Reimplemented in QwtAnalogClock, and QwtCompass. Definition at line 923 of file qwt_dial.cpp. Referenced by QwtDialScaleDraw::label(). |
|
Sets the frame shadow value from the frame style.
Definition at line 244 of file qwt_dial.cpp. References lineWidth(). |
|
Sets the line width
Definition at line 269 of file qwt_dial.cpp. |
|
Change the mode of the meter.
The default mode is QwtDial::RotateNeedle.
Definition at line 359 of file qwt_dial.cpp. |
|
Set a needle for the dial Qwt is missing a set of good looking needles. Contributions are very welcome.
Definition at line 771 of file qwt_dial.cpp. References needle(). |
|
Change the origin. The origin is the angle where scale and needle is relative to.
Definition at line 953 of file qwt_dial.cpp. |
|
Change the intervals of the scale
Definition at line 861 of file qwt_dial.cpp. References updateScale(). |
|
Change the arc of the scale
Definition at line 976 of file qwt_dial.cpp. |
|
Set an individual scale draw
Definition at line 844 of file qwt_dial.cpp. References scaleDraw(), and updateScale(). Referenced by setScaleOptions(). |
|
A wrapper method for accessing the scale draw.
Definition at line 884 of file qwt_dial.cpp. References QwtAbstractScaleDraw::enableComponent(), and setScaleDraw(). |
|
See: QwtAbstractScaleDraw::setTickLength, QwtDialScaleDraw::setPenWidth.
Definition at line 904 of file qwt_dial.cpp. References QwtDialScaleDraw::setPenWidth(), and QwtAbstractScaleDraw::setTickLength(). |
|
Sets whether it is possible to step the value from the highest value to the lowest value and vice versa to on.
Definition at line 397 of file qwt_dial.cpp. References QwtDoubleRange::setPeriodic(). |
|
Show/Hide the area outside of the frame
Definition at line 220 of file qwt_dial.cpp. References updateMask(). |
|
Definition at line 1001 of file qwt_dial.cpp. References lineWidth(). |
|
Update the mask of the dial. In case of "hasVisibleBackground() == false", the backgound is transparent by a mask.
Definition at line 1246 of file qwt_dial.cpp. References boundingRect(). Referenced by resizeEvent(), and showBackground(). |
|
Update the scale with the current attributes
Definition at line 811 of file qwt_dial.cpp. References QwtLinearScaleEngine::divideScale(), QwtDoubleRange::maxValue(), QwtDoubleRange::minValue(), and QwtLinearScaleEngine::transformation(). Referenced by rangeChange(), setScale(), and setScaleDraw(). |
|
QwtDoubleRange update hook.
Reimplemented from QwtAbstractSlider. Definition at line 992 of file qwt_dial.cpp. References QwtAbstractSlider::valueChange(). |
|
wrapping() holds whether it is possible to step the value from the highest value to the lowest value and vice versa.
Definition at line 410 of file qwt_dial.cpp. References QwtDoubleRange::periodic(). Referenced by getValue(). |