Inherits QwtSliderBase.
Inherited by QwtAnalogClock, and QwtCompass.
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:
Note:
Definition at line 72 of file qwt_dial.h.
enum Shadow { Plain = QFrame::Plain, Raised = QFrame::Raised, Sunken = QFrame::Sunken }
enum ScaleOptions { ScaleBackbone = 1, ScaleTicks = 2, ScaleLabel = 4 }
enum Mode { RotateNeedle, RotateScale }
QwtDial (QWidget *parent=0, const char *name=0)
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
virtual void paintEvent (QPaintEvent *)
virtual void resizeEvent (QResizeEvent *)
virtual void keyPressEvent (QKeyEvent *)
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 QString 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)
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 117 of file qwt_dial.h.
see QwtDial::setScaleOptions
Definition at line 105 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 97 of file qwt_dial.h.
Constructor.
Parameters:
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. Definition at line 107 of file qwt_dial.cpp.
References QwtScaleDraw::setGeometry(), QwtDblRange::setRange(), and setScaleArc().
Destructor.
Definition at line 147 of file qwt_dial.cpp.
Returns:
See also:
Definition at line 260 of file qwt_dial.cpp.
Referenced by contentsRect(), drawContents(), drawFrame(), resizeEvent(), and showBackground().
Returns:
See also:
Definition at line 243 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.
Parameters:
See also:
Definition at line 475 of file qwt_dial.cpp.
References boundingRect(), drawNeedle(), drawScale(), drawScaleContents(), QwtSliderBase::isValid(), QwtDblRange::maxValue(), QwtDblRange::minValue(), mode(), origin(), scaleContentsRect(), and QwtDblRange::value().
Draw a dotted round circle, if !isReadOnly()
Parameters:
Definition at line 394 of file qwt_dial.cpp.
References contentsRect(), and QwtSliderBase::isReadOnly().
Draw the frame around the dial
Parameters:
See also:
Definition at line 431 of file qwt_dial.cpp.
References boundingRect(), QwtPainter::drawRoundFrame(), and lineWidth().
Draw the needle
Qwt is missing a set of good looking needles. Contributions are very welcome.
Parameters:
Reimplemented in QwtAnalogClock.
Definition at line 584 of file qwt_dial.cpp.
References QwtDialNeedle::draw().
Draw the scale
Parameters:
See also:
Definition at line 606 of file qwt_dial.cpp.
References QwtScaleDraw::draw(), QwtDialScaleDraw::penWidth(), QwtScaleDraw::setAngleRange(), and QwtScaleDraw::setGeometry().
Draw the contents inside the scale
Paints nothing.
Parameters:
Reimplemented in QwtCompass.
Definition at line 643 of file qwt_dial.cpp.
Returns:
Definition at line 206 of file qwt_dial.cpp.
See also:
Implements QwtSliderBase.
Definition at line 1012 of file qwt_dial.cpp.
Find the value for a given position
Parameters:
Returns:
Implements QwtSliderBase.
Definition at line 909 of file qwt_dial.cpp.
References QwtDblRange::maxValue(), QwtDblRange::minValue(), mode(), QwtDblRange::value(), and wrapping().
TRUE when the area outside of the frame is visible
See also:
Definition at line 181 of file qwt_dial.cpp.
Handles key events
See also:
Reimplemented from QwtSliderBase.
Reimplemented in QwtCompass.
Definition at line 1044 of file qwt_dial.cpp.
References QwtDblRange::incValue(), QwtSliderBase::isReadOnly(), QwtSliderBase::isValid(), QwtDblRange::maxValue(), QwtDblRange::minValue(), QwtDblRange::pageSize(), QwtDblRange::prevValue(), QwtSliderBase::setValue(), QwtSliderBase::sliderMoved(), and QwtDblRange::value().
Referenced by QwtCompass::keyPressEvent().
Returns:
See also:
Definition at line 234 of file qwt_dial.cpp.
Referenced by contentsRect(), drawFrame(), minimumSizeHint(), setFrameShadow(), and sizeHint().
Return the upper limit of the scale arc.
Definition at line 150 of file qwt_dial.h.
Return a minimum size hint.
Warning:
Definition at line 874 of file qwt_dial.cpp.
References lineWidth(), and QwtScaleDraw::minHeight().
Return the lower limit of the scale arc.
Definition at line 148 of file qwt_dial.h.
Returns:
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:
Definition at line 329 of file qwt_dial.cpp.
References Mode.
Referenced by drawContents(), QwtCompass::drawScaleContents(), getValue(), and QwtCompass::keyPressEvent().
Returns:
See also:
Definition at line 684 of file qwt_dial.cpp.
Returns:
See also:
Definition at line 675 of file qwt_dial.cpp.
The origin is the angle where scale and needle is relative to.
Returns:
See also:
Definition at line 822 of file qwt_dial.cpp.
Referenced by drawContents(), QwtAnalogClock::drawNeedle(), QwtCompass::drawScaleContents(), and QwtCompass::keyPressEvent().
Repaint the dial.
Definition at line 372 of file qwt_dial.cpp.
References drawContents(), drawFocusIndicator(), drawFrame(), and QwtPaintBuffer::painter().
QwtDblRange update hook.
Reimplemented from QwtDblRange.
Definition at line 690 of file qwt_dial.cpp.
Resize the dial widget.
Definition at line 363 of file qwt_dial.cpp.
References boundingRect(), and hasVisibleBackground().
Returns:
See also:
Definition at line 273 of file qwt_dial.cpp.
References contentsRect(), QwtScaleDraw::maxHeight(), and QwtScaleDraw::maxWidth().
Return the scale draw.
Definition at line 171 of file qwt_dial.h.
Return the scale draw.
Definition at line 169 of file qwt_dial.h.
Returns:
Reimplemented in QwtAnalogClock, and QwtCompass.
Definition at line 789 of file qwt_dial.cpp.
Referenced by QwtDialScaleDraw::label().
Sets the frame shadow value from the frame style.
Parameters:
See also:
Definition at line 191 of file qwt_dial.cpp.
Sets the line width
Parameters:
See also:
Definition at line 217 of file qwt_dial.cpp.
Change the mode of the meter.
Parameters:
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:
Definition at line 306 of file qwt_dial.cpp.
Set a needle for the dial
Qwt is missing a set of good looking needles. Contributions are very welcome.
Parameters:
Warning:
Definition at line 659 of file qwt_dial.cpp.
Change the origin.
The origin is the angle where scale and needle is relative to.
Parameters:
See also:
Definition at line 810 of file qwt_dial.cpp.
Referenced by QwtAnalogClock::QwtAnalogClock(), and QwtCompass::QwtCompass().
Change the intervals of the scale
See also:
Definition at line 730 of file qwt_dial.cpp.
References updateScale().
Referenced by QwtAnalogClock::QwtAnalogClock().
Change the arc of the scale
Parameters:
Definition at line 833 of file qwt_dial.cpp.
Set an individual scale draw
Warning:
Definition at line 713 of file qwt_dial.cpp.
References updateScale().
Referenced by setScaleOptions().
A wrapper method for accessing the scale draw.
See also:
Definition at line 754 of file qwt_dial.cpp.
References QwtScaleDraw::options(), QwtScaleDraw::setOptions(), setScaleDraw(), QwtScaleDraw::setTickLength(), and QwtDialScaleDraw::showLabels().
Referenced by QwtAnalogClock::QwtAnalogClock(), and QwtCompass::QwtCompass().
See: QwtScaleDraw::setTickLength, QwtDialScaleDraw::setPenWidth.
Definition at line 776 of file qwt_dial.cpp.
References QwtDialScaleDraw::setPenWidth(), and QwtScaleDraw::setTickLength().
Referenced by QwtAnalogClock::QwtAnalogClock().
Sets whether it is possible to step the value from the highest value to the lowest value and vice versa to on.
Parameters:
See also:
Note:
Definition at line 344 of file qwt_dial.cpp.
References QwtDblRange::setPeriodic().
Referenced by QwtAnalogClock::QwtAnalogClock(), and QwtCompass::QwtCompass().
Show/Hide the area outside of the frame
Parameters:
See also:
Warning:
Definition at line 161 of file qwt_dial.cpp.
Returns:
Definition at line 858 of file qwt_dial.cpp.
References lineWidth(), and QwtScaleDraw::minHeight().
Update the scale with the current attributes
See also:
Definition at line 699 of file qwt_dial.cpp.
References QwtDblRange::maxValue(), QwtDblRange::minValue(), and QwtScaleDraw::setScale().
Referenced by rangeChange(), setScale(), and setScaleDraw().
QwtDblRange update hook.
Reimplemented from QwtSliderBase.
Definition at line 849 of file qwt_dial.cpp.
References QwtSliderBase::valueChange().
wrapping() holds whether it is possible to step the value from the highest value to the lowest value and vice versa.
See also:
Note:
Definition at line 357 of file qwt_dial.cpp.
References QwtDblRange::periodic().
Referenced by getValue().
Generated automatically by Doxygen for Qwt User's Guide from the source code.