Classes | Public Types | Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
QwtDial Class Reference

QwtDial class provides a rounded range control. More...

#include <qwt_dial.h>

Inheritance diagram for QwtDial:
Inheritance graph
[legend]

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
 
double minScaleArc () const
 
Mode mode () const
 
const QwtDialNeedleneedle () const
 
QwtDialNeedleneedle ()
 
double origin () const
 
 QwtDial (QWidget *parent=NULL)
 Constructor. More...
 
QwtRoundScaleDrawscaleDraw ()
 
const QwtRoundScaleDrawscaleDraw () const
 
virtual QRect scaleInnerRect () const
 
void setFrameShadow (Shadow)
 
void setLineWidth (int)
 
void setMaxScaleArc (double min)
 
void setMinScaleArc (double min)
 
void setMode (Mode)
 Change the mode of the dial. More...
 
void setNeedle (QwtDialNeedle *)
 
virtual void setOrigin (double)
 Change the origin. More...
 
void setScaleArc (double min, double max)
 
void setScaleDraw (QwtRoundScaleDraw *)
 
virtual QSize sizeHint () const
 
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 QwtScaleDivscaleDiv () const
 
const QwtScaleEnginescaleEngine () const
 
QwtScaleEnginescaleEngine ()
 
const QwtScaleMapscaleMap () const
 
int scaleMaxMajor () const
 
int scaleMaxMinor () const
 
double scaleStepSize () const
 
void setLowerBound (double value)
 
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...
 
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 *)
 
virtual void drawContents (QPainter *) const
 Draw the contents inside the frame. More...
 
virtual void drawFocusIndicator (QPainter *) const
 
virtual void drawFrame (QPainter *p)
 
virtual void drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
 
virtual void drawScale (QPainter *, const QPointF &center, double radius) const
 
virtual void drawScaleContents (QPainter *painter, const QPointF &center, double radius) const
 
void invalidateCache ()
 
virtual bool isScrollPosition (const QPoint &) const
 Determine what to do when the user presses a mouse button. More...
 
virtual void paintEvent (QPaintEvent *)
 
virtual void scaleChange ()
 
virtual double scrolledTo (const QPoint &) const
 Determine the value for a new position of the slider handle. More...
 
virtual void sliderChange ()
 Calling update() More...
 
virtual void wheelEvent (QWheelEvent *)
 
- Protected Member Functions inherited from QwtAbstractSlider
double incrementedValue (double value, int stepCount) const
 
void incrementValue (int numSteps)
 
virtual void keyPressEvent (QKeyEvent *)
 
virtual void mouseMoveEvent (QMouseEvent *)
 
virtual void mousePressEvent (QMouseEvent *)
 
virtual void mouseReleaseEvent (QMouseEvent *)
 
- Protected Member Functions inherited from QwtAbstractScale
const QwtAbstractScaleDrawabstractScaleDraw () const
 
QwtAbstractScaleDrawabstractScaleDraw ()
 
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

PrivateDatad_data
 

Additional Inherited Members

- Public Slots inherited from QwtAbstractSlider
void setValue (double val)
 
- Signals inherited from QwtAbstractSlider
void sliderMoved (double value)
 
void sliderPressed ()
 
void sliderReleased ()
 
void valueChanged (double value)
 Notify a change of value. More...
 

Detailed Description

QwtDial class provides a rounded range control.

QwtDial is intended as base class for dial widgets like speedometers, compass widgets, clocks ...

dials2.png

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 49 of file qwt_dial.h.

Member Enumeration Documentation

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 85 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 72 of file qwt_dial.h.

Constructor & Destructor Documentation

QwtDial::QwtDial ( QWidget *  parent = NULL)
explicit

Constructor.

Parameters
parentParent 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 126 of file qwt_dial.cpp.

QwtDial::~QwtDial ( )
virtual

Destructor.

Definition at line 161 of file qwt_dial.cpp.

Member Function Documentation

QRect QwtDial::boundingRect ( ) const
Returns
bounding rectangle of the dial including the frame
See also
setLineWidth(), scaleInnerRect(), innerRect()

Definition at line 236 of file qwt_dial.cpp.

void QwtDial::changeEvent ( QEvent *  event)
protectedvirtual

Change Event handler

Parameters
eventChange event

Invalidates internal paint caches if necessary

Reimplemented from QwtAbstractScale.

Definition at line 806 of file qwt_dial.cpp.

void QwtDial::drawContents ( QPainter *  painter) const
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.

Parameters
painterPainter
See also
boundingRect(), innerRect(), scaleInnerRect(), QWidget::setPalette()

Definition at line 393 of file qwt_dial.cpp.

void QwtDial::drawFocusIndicator ( QPainter *  painter) const
protectedvirtual

Draw the focus indicator

Parameters
painterPainter

Definition at line 364 of file qwt_dial.cpp.

void QwtDial::drawFrame ( QPainter *  painter)
protectedvirtual

Draw the frame around the dial

Parameters
painterPainter
See also
lineWidth(), frameShadow()

Definition at line 375 of file qwt_dial.cpp.

void QwtDial::drawNeedle ( QPainter *  painter,
const QPointF &  center,
double  radius,
double  direction,
QPalette::ColorGroup  colorGroup 
) const
protectedvirtual

Draw the needle

Parameters
painterPainter
centerCenter of the dial
radiusLength for the needle
directionDirection of the needle in degrees, counter clockwise
colorGroupColorGroup

Reimplemented in QwtAnalogClock.

Definition at line 440 of file qwt_dial.cpp.

void QwtDial::drawNeedle ( QPainter *  painter) const
private

Definition at line 450 of file qwt_dial.cpp.

void QwtDial::drawScale ( QPainter *  painter,
const QPointF &  center,
double  radius 
) const
protectedvirtual

Draw the scale

Parameters
painterPainter
centerCenter of the dial
radiusRadius of the scale

Definition at line 477 of file qwt_dial.cpp.

void QwtDial::drawScaleContents ( QPainter *  painter,
const QPointF &  center,
double  radius 
) const
protectedvirtual

Draw the contents inside the scale

Paints nothing.

Parameters
painterPainter
centerCenter of the contents circle
radiusRadius of the contents circle

Reimplemented in QwtCompass.

Definition at line 508 of file qwt_dial.cpp.

Shadow QwtDial::frameShadow ( ) const
QRect QwtDial::innerRect ( ) const
Returns
bounding rectangle of the circle inside the frame
See also
setLineWidth(), scaleInnerRect(), boundingRect()

Definition at line 226 of file qwt_dial.cpp.

void QwtDial::invalidateCache ( )
protected

Invalidate the internal caches used to speed up repainting

Definition at line 303 of file qwt_dial.cpp.

bool QwtDial::isScrollPosition ( const QPoint &  pos) const
protectedvirtual

Determine what to do when the user presses a mouse button.

Parameters
posMouse position
Return values
True,whenthe inner circle contains pos
See also
scrolledTo()

Implements QwtAbstractSlider.

Definition at line 723 of file qwt_dial.cpp.

int QwtDial::lineWidth ( ) const
double QwtDial::maxScaleArc ( ) const
QSize QwtDial::minimumSizeHint ( ) const
virtual
Returns
Minimum size hint
See also
sizeHint()

Definition at line 704 of file qwt_dial.cpp.

double QwtDial::minScaleArc ( ) const
Mode QwtDial::mode ( ) const
const QwtDialNeedle * QwtDial::needle ( ) const
Returns
needle
See also
setNeedle()

Definition at line 540 of file qwt_dial.cpp.

QwtDialNeedle * QwtDial::needle ( )
Returns
needle
See also
setNeedle()

Definition at line 549 of file qwt_dial.cpp.

double QwtDial::origin ( ) const
void QwtDial::paintEvent ( QPaintEvent *  event)
protectedvirtual

Paint the dial

Parameters
eventPaint event

Definition at line 312 of file qwt_dial.cpp.

void QwtDial::scaleChange ( )
protectedvirtual

Invalidate the internal caches and call QwtAbstractSlider::scaleChange()

Reimplemented from QwtAbstractSlider.

Definition at line 852 of file qwt_dial.cpp.

QwtRoundScaleDraw * QwtDial::scaleDraw ( )
Returns
the scale draw

Definition at line 555 of file qwt_dial.cpp.

const QwtRoundScaleDraw * QwtDial::scaleDraw ( ) const
Returns
the scale draw

Definition at line 561 of file qwt_dial.cpp.

QRect QwtDial::scaleInnerRect ( ) const
virtual
Returns
rectangle inside the scale
See also
setLineWidth(), boundingRect(), innerRect()

Definition at line 252 of file qwt_dial.cpp.

double QwtDial::scrolledTo ( const QPoint &  pos) const
protectedvirtual

Determine the value for a new position of the slider handle.

Parameters
posMouse position
Returns
Value for the mouse position
See also
isScrollPosition()

Implements QwtAbstractSlider.

Definition at line 753 of file qwt_dial.cpp.

void QwtDial::setAngleRange ( double  angle,
double  span 
)
private

Definition at line 838 of file qwt_dial.cpp.

void QwtDial::setFrameShadow ( Shadow  shadow)

Sets the frame shadow value from the frame style.

Parameters
shadowFrame shadow
See also
setLineWidth(), QFrame::setFrameShadow()

Definition at line 172 of file qwt_dial.cpp.

void QwtDial::setLineWidth ( int  lineWidth)

Sets the line width of the frame

Parameters
lineWidthLine width
See also
setFrameShadow()

Definition at line 199 of file qwt_dial.cpp.

void QwtDial::setMaxScaleArc ( double  max)

Set the upper limit for the scale arc

Parameters
maxUpper limit of the scale arc
See also
setScaleArc(), setMinScaleArc()

Definition at line 640 of file qwt_dial.cpp.

void QwtDial::setMinScaleArc ( double  min)

Set the lower limit for the scale arc

Parameters
minLower limit of the scale arc
See also
setScaleArc(), setMaxScaleArc()

Definition at line 620 of file qwt_dial.cpp.

void QwtDial::setMode ( Mode  mode)

Change the mode of the dial.

Parameters
modeNew 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 280 of file qwt_dial.cpp.

void QwtDial::setNeedle ( QwtDialNeedle needle)

Set a needle for the dial

Parameters
needleNeedle
Warning
The needle will be deleted, when a different needle is set or in ~QwtDial()

Definition at line 524 of file qwt_dial.cpp.

void QwtDial::setOrigin ( double  origin)
virtual

Change the origin.

The origin is the angle where scale and needle is relative to.

Parameters
originNew origin
See also
origin()

Definition at line 662 of file qwt_dial.cpp.

void QwtDial::setScaleArc ( double  minArc,
double  maxArc 
)

Change the arc of the scale

Parameters
minArcLower limit
maxArcUpper limit
See also
minScaleArc(), maxScaleArc()

Definition at line 590 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.

Parameters
scaleDrawScale draw
Warning
The previous scale draw is deleted

Definition at line 576 of file qwt_dial.cpp.

QSize QwtDial::sizeHint ( ) const
virtual
Returns
Size hint
See also
minimumSizeHint()

Definition at line 685 of file qwt_dial.cpp.

void QwtDial::sliderChange ( )
protectedvirtual

Calling update()

Reimplemented from QwtAbstractSlider.

Definition at line 858 of file qwt_dial.cpp.

void QwtDial::wheelEvent ( QWheelEvent *  event)
protectedvirtual

Wheel Event handler

Parameters
eventWheel event

Reimplemented from QwtAbstractSlider.

Definition at line 831 of file qwt_dial.cpp.

Member Data Documentation

PrivateData* QwtDial::d_data
private

Definition at line 164 of file qwt_dial.h.

Property Documentation

QwtDial::Shadow QwtDial::frameShadow
readwrite
Returns
Frame shadow /sa setFrameShadow(), lineWidth(), QFrame::frameShadow()

Definition at line 56 of file qwt_dial.h.

int QwtDial::lineWidth
readwrite
Returns
Line width of the frame
See also
setLineWidth(), frameShadow(), lineWidth()

Definition at line 55 of file qwt_dial.h.

double QwtDial::maxScaleArc
readwrite
Returns
Upper limit of the scale arc
See also
setScaleArc()

Definition at line 60 of file qwt_dial.h.

double QwtDial::minScaleArc
readwrite
Returns
Lower limit of the scale arc
See also
setScaleArc()

Definition at line 59 of file qwt_dial.h.

QwtDial::Mode QwtDial::mode
readwrite
Returns
Mode of the dial.
See also
setMode(), origin(), setScaleArc(), value()

Definition at line 57 of file qwt_dial.h.

double QwtDial::origin
readwrite

The origin is the angle where scale and needle is relative to.

Returns
Origin of the dial
See also
setOrigin()

Definition at line 58 of file qwt_dial.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:18