Qwt User's Guide
6.1.6
|
QwtDial class provides a rounded range control. More...
#include <qwt_dial.h>
Public Types | |
enum | Shadow { Plain = QFrame::Plain, Raised = QFrame::Raised, Sunken = QFrame::Sunken } |
Frame shadow. More... | |
enum | Mode { RotateNeedle, RotateScale } |
Mode controlling whether the needle or the scale is rotating. More... | |
Public Member Functions | |
QwtDial (QWidget *parent=NULL) | |
Constructor. More... | |
virtual | ~QwtDial () |
Destructor. | |
void | setFrameShadow (Shadow) |
Shadow | frameShadow () const |
void | setLineWidth (int) |
int | lineWidth () const |
void | setMode (Mode) |
Change the mode of the dial. More... | |
Mode | mode () const |
void | setScaleArc (double minArc, double maxArc) |
void | setMinScaleArc (double) |
double | minScaleArc () const |
void | setMaxScaleArc (double) |
double | maxScaleArc () const |
virtual void | setOrigin (double) |
Change the origin. More... | |
double | origin () const |
void | setNeedle (QwtDialNeedle *) |
const QwtDialNeedle * | needle () const |
QwtDialNeedle * | needle () |
QRect | boundingRect () const |
QRect | innerRect () const |
virtual QRect | scaleInnerRect () const |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
void | setScaleDraw (QwtRoundScaleDraw *) |
QwtRoundScaleDraw * | scaleDraw () |
const QwtRoundScaleDraw * | scaleDraw () const |
Public Member Functions inherited from QwtAbstractSlider | |
QwtAbstractSlider (QWidget *parent=NULL) | |
Constructor. More... | |
virtual | ~QwtAbstractSlider () |
Destructor. | |
void | setValid (bool) |
bool | isValid () const |
double | value () const |
Returns the current value. | |
void | setWrapping (bool) |
bool | wrapping () const |
void | setTotalSteps (uint) |
Set the number of steps. More... | |
uint | totalSteps () const |
void | setSingleSteps (uint) |
Set the number of steps for a single increment. More... | |
uint | singleSteps () const |
void | setPageSteps (uint) |
Set the number of steps for a page increment. More... | |
uint | pageSteps () const |
void | setStepAlignment (bool) |
Enable step alignment. More... | |
bool | stepAlignment () const |
void | setTracking (bool) |
Enables or disables tracking. More... | |
bool | isTracking () const |
void | setReadOnly (bool) |
bool | isReadOnly () const |
void | setInvertedControls (bool) |
bool | invertedControls () const |
Public Member Functions inherited from QwtAbstractScale | |
QwtAbstractScale (QWidget *parent=NULL) | |
virtual | ~QwtAbstractScale () |
Destructor. | |
void | setScale (double lowerBound, double upperBound) |
Specify a scale. More... | |
void | setScale (const QwtInterval &) |
Specify a scale. More... | |
void | setScale (const QwtScaleDiv &) |
Specify a scale. More... | |
const QwtScaleDiv & | scaleDiv () const |
void | setLowerBound (double value) |
double | lowerBound () const |
void | setUpperBound (double value) |
double | upperBound () const |
void | setScaleStepSize (double stepSize) |
Set the step size used for calculating a scale division. More... | |
double | scaleStepSize () const |
void | setScaleMaxMajor (int ticks) |
Set the maximum number of major tick intervals. More... | |
int | scaleMaxMinor () const |
void | setScaleMaxMinor (int ticks) |
Set the maximum number of minor tick intervals. More... | |
int | scaleMaxMajor () const |
void | setScaleEngine (QwtScaleEngine *) |
Set a scale engine. More... | |
const QwtScaleEngine * | scaleEngine () const |
QwtScaleEngine * | scaleEngine () |
int | transform (double) const |
double | invTransform (int) const |
bool | isInverted () const |
double | minimum () const |
double | maximum () const |
const QwtScaleMap & | scaleMap () const |
Protected Member Functions | |
virtual void | wheelEvent (QWheelEvent *) |
virtual void | paintEvent (QPaintEvent *) |
virtual void | changeEvent (QEvent *) |
virtual void | drawFrame (QPainter *) |
virtual void | drawContents (QPainter *) const |
Draw the contents inside the frame. More... | |
virtual void | drawFocusIndicator (QPainter *) const |
void | invalidateCache () |
virtual void | drawScale (QPainter *, const QPointF ¢er, double radius) const |
virtual void | drawScaleContents (QPainter *painter, const QPointF ¢er, double radius) const |
virtual void | drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const |
virtual double | scrolledTo (const QPoint &) const |
Determine the value for a new position of the slider handle. More... | |
virtual bool | isScrollPosition (const QPoint &) const |
Determine what to do when the user presses a mouse button. More... | |
virtual void | sliderChange () |
Calling update() | |
virtual void | scaleChange () |
Protected Member Functions inherited from QwtAbstractSlider | |
virtual void | mousePressEvent (QMouseEvent *) |
virtual void | mouseReleaseEvent (QMouseEvent *) |
virtual void | mouseMoveEvent (QMouseEvent *) |
virtual void | keyPressEvent (QKeyEvent *) |
void | incrementValue (int stepCount) |
double | incrementedValue (double value, int stepCount) const |
Protected Member Functions inherited from QwtAbstractScale | |
void | rescale (double lowerBound, double upperBound, double stepSize) |
void | setAbstractScaleDraw (QwtAbstractScaleDraw *) |
Set a scale draw. More... | |
const QwtAbstractScaleDraw * | abstractScaleDraw () const |
QwtAbstractScaleDraw * | abstractScaleDraw () |
Additional Inherited Members | |
Public Slots inherited from QwtAbstractSlider | |
void | setValue (double value) |
Signals inherited from QwtAbstractSlider | |
void | valueChanged (double value) |
Notify a change of value. More... | |
void | sliderPressed () |
void | sliderReleased () |
void | sliderMoved (double value) |
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().
enum QwtDial::Mode |
enum QwtDial::Shadow |
|
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.
QRect QwtDial::boundingRect | ( | ) | const |
|
protectedvirtual |
Change Event handler
event | Change event |
Invalidates internal paint caches if necessary
|
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 |
|
protectedvirtual |
Draw the focus indicator
painter | Painter |
|
protectedvirtual |
|
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.
|
protectedvirtual |
Draw the scale
painter | Painter |
center | Center of the dial |
radius | Radius of the scale |
|
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.
QwtDial::Shadow QwtDial::frameShadow | ( | ) | const |
QRect QwtDial::innerRect | ( | ) | const |
|
protected |
Invalidate the internal caches used to speed up repainting
|
protectedvirtual |
Determine what to do when the user presses a mouse button.
pos | Mouse position |
True,when | the inner circle contains pos |
Implements QwtAbstractSlider.
int QwtDial::lineWidth | ( | ) | const |
double QwtDial::maxScaleArc | ( | ) | const |
|
virtual |
double QwtDial::minScaleArc | ( | ) | const |
QwtDial::Mode QwtDial::mode | ( | ) | const |
QwtDialNeedle * QwtDial::needle | ( | ) |
const QwtDialNeedle * QwtDial::needle | ( | ) | const |
double QwtDial::origin | ( | ) | const |
The origin is the angle where scale and needle is relative to.
|
protectedvirtual |
Paint the dial
event | Paint event |
|
protectedvirtual |
Invalidate the internal caches and call QwtAbstractSlider::scaleChange()
Reimplemented from QwtAbstractSlider.
QwtRoundScaleDraw * QwtDial::scaleDraw | ( | ) |
const QwtRoundScaleDraw * QwtDial::scaleDraw | ( | ) | const |
|
virtual |
|
protectedvirtual |
Determine the value for a new position of the slider handle.
pos | Mouse position |
Implements QwtAbstractSlider.
void QwtDial::setFrameShadow | ( | Shadow | shadow | ) |
Sets the frame shadow value from the frame style.
shadow | Frame shadow |
void QwtDial::setLineWidth | ( | int | lineWidth | ) |
void QwtDial::setMaxScaleArc | ( | double | max | ) |
Set the upper limit for the scale arc
max | Upper limit of the scale arc |
void QwtDial::setMinScaleArc | ( | double | min | ) |
Set the lower limit for the scale arc
min | Lower limit of the scale arc |
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.
void QwtDial::setNeedle | ( | QwtDialNeedle * | needle | ) |
Set a needle for the dial
needle | Needle |
|
virtual |
Change the origin.
The origin is the angle where scale and needle is relative to.
origin | New origin |
void QwtDial::setScaleArc | ( | double | minArc, |
double | maxArc | ||
) |
Change the arc of the scale
minArc | Lower limit |
maxArc | Upper limit |
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 |
|
virtual |
|
protectedvirtual |