QwtDial − QwtDial class provides a rounded range control.
#include <qwt_dial.h>
Inherits QwtAbstractSlider.
Inherited by QwtAnalogClock, and QwtCompass.
enum
Shadow { Plain = QFrame::Plain, Raised
= QFrame::Raised, Sunken = QFrame::Sunken }
Frame shadow.
enum Mode { RotateNeedle, RotateScale }
Mode controlling whether the needle or the scale is
rotating.
QwtDial
(QWidget *parent=NULL)
Constructor.
virtual ˜QwtDial ()
Destructor.
void setFrameShadow (Shadow)
Shadow frameShadow () const
void setLineWidth (int)
int lineWidth () const
void setMode (Mode)
Change the mode of the dial.
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.
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 override
virtual QSize minimumSizeHint () const override
void setScaleDraw (QwtRoundScaleDraw *)
QwtRoundScaleDraw * scaleDraw ()
const QwtRoundScaleDraw * scaleDraw ()
const
Public Member Functions inherited from QwtAbstractSlider
QwtAbstractSlider
(QWidget *parent=NULL)
Constructor.
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.
uint totalSteps () const
void setSingleSteps (uint)
Set the number of steps for a single increment.
uint singleSteps () const
void setPageSteps (uint)
Set the number of steps for a page increment.
uint pageSteps () const
void setStepAlignment (bool)
Enable step alignment.
bool stepAlignment () const
void setTracking (bool)
Enables or disables tracking.
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.
void setScale (const QwtInterval &)
Specify a scale.
void setScale (const QwtScaleDiv &)
Specify a scale.
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.
double scaleStepSize () const
void setScaleMaxMajor (int ticks)
Set the maximum number of major tick intervals.
int scaleMaxMinor () const
void setScaleMaxMinor (int ticks)
Set the maximum number of minor tick intervals.
int scaleMaxMajor () const
void setScaleEngine (QwtScaleEngine *)
Set a scale engine.
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
virtual void
wheelEvent (QWheelEvent *) override
virtual void paintEvent (QPaintEvent *) override
virtual void changeEvent (QEvent *) override
virtual void drawFrame (QPainter *)
virtual void drawContents (QPainter *) const
Draw the contents inside the frame.
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
override
Determine the value for a new position of the slider handle.
virtual bool isScrollPosition (const QPoint &)
const override
Determine what to do when the user presses a mouse button.
virtual void sliderChange () override
Calling update()
virtual void scaleChange () override
Protected Member Functions inherited from QwtAbstractSlider
virtual void
mousePressEvent (QMouseEvent *) override
virtual void mouseReleaseEvent (QMouseEvent *)
override
virtual void mouseMoveEvent (QMouseEvent *) override
virtual void keyPressEvent (QKeyEvent *) override
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.
const QwtAbstractScaleDraw * abstractScaleDraw
() const
QwtAbstractScaleDraw * abstractScaleDraw ()
void updateScaleDraw ()
Public Slots inherited from QwtAbstractSlider
void setValue (double value)
Signals inherited from QwtAbstractSlider
void valueChanged
(double value)
Notify a change of value.
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().
See also
QwtCompass, QwtAnalogClock, QwtDialNeedle
Note
The controls and dials examples shows different types of dials.
QDial is more similar to QwtKnob than to QwtDial
Definition at line 50 of file qwt_dial.h.
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.
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.
Constructor.
Parameters
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.
Destructor.
Definition at line 159 of file qwt_dial.cpp.
Returns
bounding rectangle of the dial including the frame
See also
setLineWidth(), scaleInnerRect(), innerRect()
Definition at line 234 of file qwt_dial.cpp.
Change Event handler
Parameters
event Change event
Invalidates internal paint caches if necessary
Reimplemented from QwtAbstractScale.
Definition at line 804 of file qwt_dial.cpp.
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.
Parameters
painter Painter
See also
boundingRect(), innerRect(), scaleInnerRect(), QWidget::setPalette()
Definition at line 391 of file qwt_dial.cpp.
Draw the focus indicator
Parameters
painter Painter
Definition at line 362 of file qwt_dial.cpp.
Draw the frame around the dial
Parameters
painter Painter
See also
lineWidth(), frameShadow()
Definition at line 373 of file qwt_dial.cpp.
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
colorGroup ColorGroup
Reimplemented in QwtAnalogClock.
Definition at line 438 of file qwt_dial.cpp.
Draw the scale
Parameters
painter Painter
center Center of the dial
radius Radius of the scale
Definition at line 475 of file qwt_dial.cpp.
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.
Definition at line 506 of file qwt_dial.cpp.
Returns
Frame shadow /sa setFrameShadow(), lineWidth(), QFrame::frameShadow()
Definition at line 186 of file qwt_dial.cpp.
Returns
bounding rectangle of the circle inside the frame
See also
setLineWidth(), scaleInnerRect(), boundingRect()
Definition at line 224 of file qwt_dial.cpp.
Invalidate the internal caches used to speed up repainting
Definition at line 301 of file qwt_dial.cpp.
Determine what to do when the user presses a mouse button.
Parameters
pos Mouse position
Return values
True,when the inner circle contains pos
See also
scrolledTo()
Implements QwtAbstractSlider.
Definition at line 721 of file qwt_dial.cpp.
Returns
Line width of the frame
See also
setLineWidth(), frameShadow(), lineWidth()
Definition at line 215 of file qwt_dial.cpp.
Returns
Upper limit of the scale arc
See also
setScaleArc()
Definition at line 647 of file qwt_dial.cpp.
Returns
Minimum size hint
See also
sizeHint()
Definition at line 702 of file qwt_dial.cpp.
Returns
Lower limit of the scale arc
See also
setScaleArc()
Definition at line 627 of file qwt_dial.cpp.
Returns
Mode of the dial.
See also
setMode(), origin(), setScaleArc(), value()
Definition at line 293 of file qwt_dial.cpp.
Returns
needle
See also
setNeedle()
Definition at line 547 of file qwt_dial.cpp.
Returns
needle
See also
setNeedle()
Definition at line 538 of file qwt_dial.cpp.
The origin is the angle where scale and needle is relative to.
Returns
Origin of the dial
See also
setOrigin()
Definition at line 674 of file qwt_dial.cpp.
Paint the dial
Parameters
event Paint event
Definition at line 310 of file qwt_dial.cpp.
Invalidate the internal caches and call QwtAbstractSlider::scaleChange()
Reimplemented from QwtAbstractSlider.
Definition at line 855 of file qwt_dial.cpp.
Returns
the scale draw
Definition at line 553 of file qwt_dial.cpp.
Returns
the scale draw
Definition at line 559 of file qwt_dial.cpp.
Returns
rectangle inside the scale
See also
setLineWidth(), boundingRect(), innerRect()
Definition at line 250 of file qwt_dial.cpp.
Determine the value for a new position of the slider handle.
Parameters
pos Mouse position
Returns
Value for the mouse position
See also
isScrollPosition()
Implements QwtAbstractSlider.
Definition at line 751 of file qwt_dial.cpp.
Sets the frame shadow value from the frame style.
Parameters
shadow Frame shadow
See also
setLineWidth(), QFrame::setFrameShadow()
Definition at line 170 of file qwt_dial.cpp.
Sets the line width of the frame
Parameters
lineWidth Line width
See also
setFrameShadow()
Definition at line 197 of file qwt_dial.cpp.
Set the upper limit for the scale arc
Parameters
max Upper limit of the scale arc
See also
setScaleArc(), setMinScaleArc()
Definition at line 638 of file qwt_dial.cpp.
Set the lower limit for the scale arc
Parameters
min Lower limit of the scale arc
See also
setScaleArc(), setMaxScaleArc()
Definition at line 618 of file qwt_dial.cpp.
Change the mode of the dial.
Parameters
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.
See also
mode(), setValue(), setOrigin()
Definition at line 278 of file qwt_dial.cpp.
Set a needle for the dial
Parameters
needle Needle
Warning
The needle will be deleted, when a different needle is set or in ˜QwtDial()
Definition at line 522 of file qwt_dial.cpp.
Change the origin. The origin is the angle where scale and needle is relative to.
Parameters
origin New origin
See also
origin()
Definition at line 660 of file qwt_dial.cpp.
Change the arc of the scale
Parameters
minArc Lower limit
maxArc Upper limit
See also
minScaleArc(), maxScaleArc()
Definition at line 588 of file qwt_dial.cpp.
Set an individual scale draw
The motivation for setting a scale draw is often to overload QwtRoundScaleDraw::label() to return individual tick labels.
Parameters
scaleDraw Scale draw
Warning
The previous scale draw is deleted
Definition at line 574 of file qwt_dial.cpp.
Returns
Size hint
See also
minimumSizeHint()
Definition at line 683 of file qwt_dial.cpp.
Calling update()
Reimplemented from QwtAbstractSlider.
Definition at line 861 of file qwt_dial.cpp.
Wheel Event handler
Parameters
event Wheel event
Reimplemented from QwtAbstractSlider.
Definition at line 829 of file qwt_dial.cpp.
Generated automatically by Doxygen for Qwt User’s Guide from the source code.