QwtDial class provides a rounded range control. More...
#include <qwt_dial.h>
Classes | |
class | PrivateData |
Public Types | |
enum | Mode { RotateNeedle, RotateScale } |
Mode controlling whether the needle or the scale is rotating. More... | |
enum | Shadow { Plain = QFrame::Plain, Raised = QFrame::Raised, Sunken = QFrame::Sunken } |
Frame shadow. More... | |
Public Member Functions | |
QRect | boundingRect () const |
Shadow | frameShadow () const |
QRect | innerRect () const |
int | lineWidth () const |
double | maxScaleArc () const |
virtual QSize | minimumSizeHint () const QWT_OVERRIDE |
double | minScaleArc () const |
Mode | mode () const |
QwtDialNeedle * | needle () |
const QwtDialNeedle * | needle () const |
double | origin () const |
QwtDial (QWidget *parent=NULL) | |
Constructor. More... | |
QwtRoundScaleDraw * | scaleDraw () |
const QwtRoundScaleDraw * | scaleDraw () const |
virtual QRect | scaleInnerRect () const |
void | setFrameShadow (Shadow) |
void | setLineWidth (int) |
void | setMaxScaleArc (double) |
void | setMinScaleArc (double) |
void | setMode (Mode) |
Change the mode of the dial. More... | |
void | setNeedle (QwtDialNeedle *) |
virtual void | setOrigin (double) |
Change the origin. More... | |
void | setScaleArc (double minArc, double maxArc) |
void | setScaleDraw (QwtRoundScaleDraw *) |
virtual QSize | sizeHint () const QWT_OVERRIDE |
virtual | ~QwtDial () |
Destructor. More... | |
Public Member Functions inherited from QwtAbstractSlider | |
bool | invertedControls () const |
bool | isReadOnly () const |
bool | isTracking () const |
bool | isValid () const |
uint | pageSteps () const |
QwtAbstractSlider (QWidget *parent=NULL) | |
Constructor. More... | |
void | setInvertedControls (bool) |
void | setPageSteps (uint) |
Set the number of steps for a page increment. More... | |
void | setReadOnly (bool) |
void | setSingleSteps (uint) |
Set the number of steps for a single increment. More... | |
void | setStepAlignment (bool) |
Enable step alignment. More... | |
void | setTotalSteps (uint) |
Set the number of steps. More... | |
void | setTracking (bool) |
Enables or disables tracking. More... | |
void | setValid (bool) |
void | setWrapping (bool) |
uint | singleSteps () const |
bool | stepAlignment () const |
uint | totalSteps () const |
double | value () const |
bool | wrapping () const |
virtual | ~QwtAbstractSlider () |
Destructor. More... | |
Public Member Functions inherited from QwtAbstractScale | |
double | invTransform (int) const |
bool | isInverted () const |
double | lowerBound () const |
double | maximum () const |
double | minimum () const |
QwtAbstractScale (QWidget *parent=NULL) | |
const QwtScaleDiv & | scaleDiv () const |
QwtScaleEngine * | scaleEngine () |
const QwtScaleEngine * | scaleEngine () const |
const QwtScaleMap & | scaleMap () const |
int | scaleMaxMajor () const |
int | scaleMaxMinor () const |
double | scaleStepSize () const |
void | setLowerBound (double value) |
void | setScale (const QwtInterval &) |
Specify a scale. More... | |
void | setScale (const QwtScaleDiv &) |
Specify a scale. More... | |
void | setScale (double lowerBound, double upperBound) |
Specify a scale. More... | |
void | setScaleEngine (QwtScaleEngine *) |
Set a scale engine. More... | |
void | setScaleMaxMajor (int ticks) |
Set the maximum number of major tick intervals. More... | |
void | setScaleMaxMinor (int ticks) |
Set the maximum number of minor tick intervals. More... | |
void | setScaleStepSize (double stepSize) |
Set the step size used for calculating a scale division. More... | |
void | setUpperBound (double value) |
int | transform (double) const |
double | upperBound () const |
virtual | ~QwtAbstractScale () |
Destructor. More... | |
Protected Member Functions | |
virtual void | changeEvent (QEvent *) QWT_OVERRIDE |
virtual void | drawContents (QPainter *) const |
Draw the contents inside the frame. More... | |
virtual void | drawFocusIndicator (QPainter *) const |
virtual void | drawFrame (QPainter *) |
virtual void | drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const |
virtual void | drawScale (QPainter *, const QPointF ¢er, double radius) const |
virtual void | drawScaleContents (QPainter *painter, const QPointF ¢er, double radius) const |
void | invalidateCache () |
virtual bool | isScrollPosition (const QPoint &) const QWT_OVERRIDE |
Determine what to do when the user presses a mouse button. More... | |
virtual void | paintEvent (QPaintEvent *) QWT_OVERRIDE |
virtual void | scaleChange () QWT_OVERRIDE |
virtual double | scrolledTo (const QPoint &) const QWT_OVERRIDE |
Determine the value for a new position of the slider handle. More... | |
virtual void | sliderChange () QWT_OVERRIDE |
Calling update() More... | |
virtual void | wheelEvent (QWheelEvent *) QWT_OVERRIDE |
Protected Member Functions inherited from QwtAbstractSlider | |
double | incrementedValue (double value, int stepCount) const |
void | incrementValue (int stepCount) |
virtual void | keyPressEvent (QKeyEvent *) QWT_OVERRIDE |
virtual void | mouseMoveEvent (QMouseEvent *) QWT_OVERRIDE |
virtual void | mousePressEvent (QMouseEvent *) QWT_OVERRIDE |
virtual void | mouseReleaseEvent (QMouseEvent *) QWT_OVERRIDE |
Protected Member Functions inherited from QwtAbstractScale | |
QwtAbstractScaleDraw * | abstractScaleDraw () |
const QwtAbstractScaleDraw * | abstractScaleDraw () const |
void | rescale (double lowerBound, double upperBound, double stepSize) |
void | setAbstractScaleDraw (QwtAbstractScaleDraw *) |
Set a scale draw. More... | |
void | updateScaleDraw () |
Properties | |
Shadow | frameShadow |
int | lineWidth |
double | maxScaleArc |
double | minScaleArc |
Mode | mode |
double | origin |
Properties inherited from QwtAbstractSlider | |
bool | invertedControls |
uint | pageSteps |
bool | readOnly |
uint | singleSteps |
bool | stepAlignment |
uint | totalSteps |
bool | tracking |
double | value |
Returns the current value. More... | |
bool | wrapping |
Properties inherited from QwtAbstractScale | |
double | lowerBound |
int | scaleMaxMajor |
int | scaleMaxMinor |
double | scaleStepSize |
double | upperBound |
Private Member Functions | |
void | drawNeedle (QPainter *) const |
void | setAngleRange (double angle, double span) |
Private Attributes | |
PrivateData * | m_data |
Additional Inherited Members | |
Public Slots inherited from QwtAbstractSlider | |
void | setValue (double value) |
Signals inherited from QwtAbstractSlider | |
void | sliderMoved (double value) |
void | sliderPressed () |
void | sliderReleased () |
void | valueChanged (double value) |
Notify a change of value. More... | |
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 QwtAbstractSlider::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.
Often dials have to be updated very often according to values from external devices. For these high refresh rates QwtDial caches as much as possible. For derived classes it might be necessary to clear these caches manually according to attribute changes using invalidateCache().
Definition at line 50 of file qwt_dial.h.
enum QwtDial::Mode |
Mode controlling whether the needle or the scale is rotating.
Enumerator | |
---|---|
RotateNeedle | The needle is rotating. |
RotateScale | The needle is fixed, the scales are rotating. |
Definition at line 86 of file qwt_dial.h.
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.
Enumerator | |
---|---|
Plain | QFrame::Plain. |
Raised | QFrame::Raised. |
Sunken | QFrame::Sunken. |
Definition at line 73 of file qwt_dial.h.
|
explicit |
Constructor.
parent | Parent widget |
Create a dial widget with no needle. The scale is initialized to [ 0.0, 360.0 ] and 360 steps ( QwtAbstractSlider::setTotalSteps() ). The origin of the scale is at 90°,
The value is set to 0.0.
The default mode is QwtDial::RotateNeedle.
Definition at line 124 of file qwt_dial.cpp.
|
virtual |
Destructor.
Definition at line 159 of file qwt_dial.cpp.
QRect QwtDial::boundingRect | ( | ) | const |
Definition at line 234 of file qwt_dial.cpp.
|
protectedvirtual |
Change Event handler
event | Change event |
Invalidates internal paint caches if necessary
Reimplemented from QwtAbstractScale.
Definition at line 804 of file qwt_dial.cpp.
|
protectedvirtual |
Draw the contents inside the frame.
QPalette::Window is the background color outside of the frame. QPalette::Base is the background color inside the frame. QPalette::WindowText is the background color inside the scale.
painter | Painter |
Definition at line 391 of file qwt_dial.cpp.
|
protectedvirtual |
|
protectedvirtual |
Draw the frame around the dial
painter | Painter |
Definition at line 373 of file qwt_dial.cpp.
|
private |
Definition at line 448 of file qwt_dial.cpp.
|
protectedvirtual |
Draw the needle
painter | Painter |
center | Center of the dial |
radius | Length for the needle |
direction | Direction of the needle in degrees, counter clockwise |
colorGroup | ColorGroup |
Reimplemented in QwtAnalogClock.
Definition at line 438 of file qwt_dial.cpp.
|
protectedvirtual |
Draw the scale
painter | Painter |
center | Center of the dial |
radius | Radius of the scale |
Definition at line 475 of file qwt_dial.cpp.
|
protectedvirtual |
Draw the contents inside the scale
Paints nothing.
painter | Painter |
center | Center of the contents circle |
radius | Radius of the contents circle |
Reimplemented in QwtCompass.
Definition at line 506 of file qwt_dial.cpp.
Shadow QwtDial::frameShadow | ( | ) | const |
QRect QwtDial::innerRect | ( | ) | const |
Definition at line 224 of file qwt_dial.cpp.
|
protected |
Invalidate the internal caches used to speed up repainting
Definition at line 301 of file qwt_dial.cpp.
|
protectedvirtual |
Determine what to do when the user presses a mouse button.
pos | Mouse position |
True,when | the inner circle contains pos |
Implements QwtAbstractSlider.
Definition at line 721 of file qwt_dial.cpp.
int QwtDial::lineWidth | ( | ) | const |
double QwtDial::maxScaleArc | ( | ) | const |
|
virtual |
double QwtDial::minScaleArc | ( | ) | const |
Mode QwtDial::mode | ( | ) | const |
QwtDialNeedle* QwtDial::needle | ( | ) |
QwtDialNeedle * QwtDial::needle | ( | ) | const |
double QwtDial::origin | ( | ) | const |
|
protectedvirtual |
|
protectedvirtual |
Invalidate the internal caches and call QwtAbstractSlider::scaleChange()
Reimplemented from QwtAbstractSlider.
Definition at line 855 of file qwt_dial.cpp.
const QwtRoundScaleDraw * QwtDial::scaleDraw | ( | ) |
Definition at line 553 of file qwt_dial.cpp.
const QwtRoundScaleDraw* QwtDial::scaleDraw | ( | ) | const |
|
virtual |
Definition at line 250 of file qwt_dial.cpp.
|
protectedvirtual |
Determine the value for a new position of the slider handle.
pos | Mouse position |
Implements QwtAbstractSlider.
Definition at line 751 of file qwt_dial.cpp.
|
private |
Definition at line 842 of file qwt_dial.cpp.
void QwtDial::setFrameShadow | ( | Shadow | shadow | ) |
Sets the frame shadow value from the frame style.
shadow | Frame shadow |
Definition at line 170 of file qwt_dial.cpp.
void QwtDial::setLineWidth | ( | int | lineWidth | ) |
Sets the line width of the frame
lineWidth | Line width |
Definition at line 197 of file qwt_dial.cpp.
void QwtDial::setMaxScaleArc | ( | double | max | ) |
Set the upper limit for the scale arc
max | Upper limit of the scale arc |
Definition at line 638 of file qwt_dial.cpp.
void QwtDial::setMinScaleArc | ( | double | min | ) |
Set the lower limit for the scale arc
min | Lower limit of the scale arc |
Definition at line 618 of file qwt_dial.cpp.
void QwtDial::setMode | ( | Mode | mode | ) |
Change the mode of the dial.
mode | New mode |
In case of QwtDial::RotateNeedle 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.
Definition at line 278 of file qwt_dial.cpp.
void QwtDial::setNeedle | ( | QwtDialNeedle * | needle | ) |
Set a needle for the dial
needle | Needle |
Definition at line 522 of file qwt_dial.cpp.
|
virtual |
Change the origin.
The origin is the angle where scale and needle is relative to.
origin | New origin |
Definition at line 660 of file qwt_dial.cpp.
void QwtDial::setScaleArc | ( | double | minArc, |
double | maxArc | ||
) |
Change the arc of the scale
minArc | Lower limit |
maxArc | Upper limit |
Definition at line 588 of file qwt_dial.cpp.
void QwtDial::setScaleDraw | ( | QwtRoundScaleDraw * | scaleDraw | ) |
Set an individual scale draw
The motivation for setting a scale draw is often to overload QwtRoundScaleDraw::label() to return individual tick labels.
scaleDraw | Scale draw |
Definition at line 574 of file qwt_dial.cpp.
|
virtual |
|
protectedvirtual |
|
protectedvirtual |
Wheel Event handler
event | Wheel event |
Reimplemented from QwtAbstractSlider.
Definition at line 829 of file qwt_dial.cpp.
|
private |
Definition at line 165 of file qwt_dial.h.
|
readwrite |
Definition at line 57 of file qwt_dial.h.
|
readwrite |
Definition at line 56 of file qwt_dial.h.
|
readwrite |
|
readwrite |
|
readwrite |
Definition at line 58 of file qwt_dial.h.
|
readwrite |
The origin is the angle where scale and needle is relative to.
Definition at line 59 of file qwt_dial.h.