QwtDial - QwtDial class provides a rounded range control.
Contents
Constructor & Destructor Documentation
QwtDial::QwtDial(QWidget*parent=NULL)[explicit]
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.
Detailed Description
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().
Seealso:QwtCompass, QwtAnalogClock, QwtDialNeedleNote:
The controls and dials examples shows different types of dials.
QDial is more similar to QwtKnob than to QwtDialMember Enumeration Documentation
enumQwtDial::Mode
Mode controlling whether the needle or the scale is rotating.
EnumeratorRotateNeedle
The needle is rotating.
RotateScale
The needle is fixed, the scales are rotating.
enumQwtDial::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.
EnumeratorPlain QFrame::Plain.
Raised QFrame::Raised.
Sunken QFrame::Sunken.
Member Function Documentation
QRectQwtDial::boundingRect()constReturns:
bounding rectangle of the dial including the frame
Seealso:setLineWidth(), scaleInnerRect(), innerRect()voidQwtDial::changeEvent(QEvent*event)[protected],[virtual]
Change Event handler
Parameters:event Change event
Invalidates internal paint caches if necessary
voidQwtDial::drawContents(QPainter*painter)const[protected],[virtual]
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
Seealso:boundingRect(), innerRect(), scaleInnerRect(), QWidget::setPalette()
voidQwtDial::drawFocusIndicator(QPainter*painter)const[protected],[virtual]
Draw the focus indicator
Parameters:painter Painter
voidQwtDial::drawFrame(QPainter*painter)[protected],[virtual]
Draw the frame around the dial
Parameters:painter Painter
Seealso:lineWidth(), frameShadow()voidQwtDial::drawNeedle(QPainter*painter,constQPointF¢er,doubleradius,doubledirection,QPalette::ColorGroupcolorGroup)const[protected],[virtual]
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.
voidQwtDial::drawScale(QPainter*painter,constQPointF¢er,doubleradius)const[protected],[virtual]
Draw the scale
Parameters:painter Painter
center Center of the dial
radius Radius of the scale
voidQwtDial::drawScaleContents(QPainter*painter,constQPointF¢er,doubleradius)const[protected],[virtual]
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.
QwtDial::ShadowQwtDial::frameShadow()constReturns:
Frame shadow /sa setFrameShadow(), lineWidth(), QFrame::frameShadow()
QRectQwtDial::innerRect()constReturns:
bounding rectangle of the circle inside the frame
Seealso:setLineWidth(), scaleInnerRect(), boundingRect()voidQwtDial::invalidateCache()[protected]
Invalidate the internal caches used to speed up repainting
boolQwtDial::isScrollPosition(constQPoint&pos)const[protected],[virtual]
Determine what to do when the user presses a mouse button.
Parameters:pos Mouse position
Returnvalues:True,when the inner circle contains pos
Seealso:scrolledTo()
Implements QwtAbstractSlider.
intQwtDial::lineWidth()constReturns:
Line width of the frame
Seealso:setLineWidth(), frameShadow(), lineWidth()doubleQwtDial::maxScaleArc()constReturns:
Upper limit of the scale arc
Seealso:setScaleArc()QSizeQwtDial::minimumSizeHint()const[virtual]Returns:
Minimum size hint
Seealso:sizeHint()doubleQwtDial::minScaleArc()constReturns:
Lower limit of the scale arc
Seealso:setScaleArc()QwtDial::ModeQwtDial::mode()constReturns:
Mode of the dial.
Seealso:setMode(), origin(), setScaleArc(), value()constQwtDialNeedle*QwtDial::needle()constReturns:
needle
Seealso:setNeedle()QwtDialNeedle*QwtDial::needle()Returns:
needle
Seealso:setNeedle()doubleQwtDial::origin()const
The origin is the angle where scale and needle is relative to.
Returns:
Origin of the dial
Seealso:setOrigin()voidQwtDial::paintEvent(QPaintEvent*event)[protected],[virtual]
Paint the dial
Parameters:event Paint event
voidQwtDial::scaleChange()[protected],[virtual]
Invalidate the internal caches and call QwtAbstractSlider::scaleChange()
Reimplemented from QwtAbstractSlider.
QwtRoundScaleDraw*QwtDial::scaleDraw()Returns:
the scale draw
constQwtRoundScaleDraw*QwtDial::scaleDraw()constReturns:
the scale draw
QRectQwtDial::scaleInnerRect()const[virtual]Returns:
rectangle inside the scale
Seealso:setLineWidth(), boundingRect(), innerRect()doubleQwtDial::scrolledTo(constQPoint&pos)const[protected],[virtual]
Determine the value for a new position of the slider handle.
Parameters:pos Mouse position
Returns:
Value for the mouse position
Seealso:isScrollPosition()
Implements QwtAbstractSlider.
voidQwtDial::setFrameShadow(Shadowshadow)
Sets the frame shadow value from the frame style.
Parameters:shadow Frame shadow
Seealso:setLineWidth(), QFrame::setFrameShadow()
voidQwtDial::setLineWidth(intlineWidth)
Sets the line width of the frame
Parameters:lineWidth Line width
Seealso:setFrameShadow()voidQwtDial::setMaxScaleArc(doublemax)
Set the upper limit for the scale arc
Parameters:max Upper limit of the scale arc
Seealso:setScaleArc(), setMinScaleArc()voidQwtDial::setMinScaleArc(doublemin)
Set the lower limit for the scale arc
Parameters:min Lower limit of the scale arc
Seealso:setScaleArc(), setMaxScaleArc()voidQwtDial::setMode(Modemode)
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.
Seealso:mode(), setValue(), setOrigin()voidQwtDial::setNeedle(QwtDialNeedle*needle)
Set a needle for the dial
Parameters:needle Needle
Warning:
The needle will be deleted, when a different needle is set or in ~QwtDial()voidQwtDial::setOrigin(doubleorigin)[virtual]
Change the origin. The origin is the angle where scale and needle is relative to.
Parameters:origin New origin
Seealso:origin()voidQwtDial::setScaleArc(doubleminArc,doublemaxArc)
Change the arc of the scale
Parameters:minArc Lower limit
maxArc Upper limit
Seealso:minScaleArc(), maxScaleArc()voidQwtDial::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.
Parameters:scaleDraw Scale draw
Warning:
The previous scale draw is deleted
QSizeQwtDial::sizeHint()const[virtual]Returns:
Size hint
Seealso:minimumSizeHint()voidQwtDial::wheelEvent(QWheelEvent*event)[protected],[virtual]
Wheel Event handler
Parameters:event Wheel event
Reimplemented from QwtAbstractSlider.
Name
QwtDial - QwtDial class provides a rounded range control.
Synopsis
#include <qwt_dial.h>
Inherits QwtAbstractSlider.
Inherited by QwtAnalogClock, and QwtCompass.
PublicTypes
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.
PublicMemberFunctionsQwtDial (QWidget *parent=NULL)
Constructor.
virtual ~QwtDial ()
Destructor.
void setFrameShadow (Shadow)
ShadowframeShadow () const
void setLineWidth (int)
int lineWidth () const
void setMode (Mode)
Change the mode of the dial.
Modemode () 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
virtual QSize minimumSizeHint () const
void setScaleDraw (QwtRoundScaleDraw *)
QwtRoundScaleDraw * scaleDraw ()
const QwtRoundScaleDraw * scaleDraw () const
ProtectedMemberFunctions
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.
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.
virtual bool isScrollPosition (const QPoint &) const
Determine what to do when the user presses a mouse button.
virtual void sliderChange ()
Calling update()
virtual void scaleChange ()
AdditionalInheritedMembers