QwtAnalogClock Class Reference

An analog clock. More...

`#include <qwt_analog_clock.h>`

Inheritance diagram for QwtAnalogClock:
[legend]

## Public Types

enum | Hand { SecondHand, MinuteHand, HourHand, NHands }
Public Types inherited from QwtDial
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 Slots

void | setCurrentTime ()
| Set the current time.
void | setTime (const QTime &)
Public Slots inherited from QwtAbstractSlider
void | setValue (double value)

## Public Member Functions

| QwtAnalogClock (QWidget *parent=NULL)
virtual | ~QwtAnalogClock ()
| Destructor.
void | setHand (Hand, QwtDialNeedle *)
const QwtDialNeedle * | hand (Hand) const
QwtDialNeedle * | hand (Hand)
Public Member Functions inherited from QwtDial
| 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 | drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
| Draw the needle. More...
virtual void | drawHand (QPainter *, Hand, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
Protected Member Functions inherited from QwtDial
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 &center, double radius) const
virtual void | drawScaleContents (QPainter *painter, const QPointF &center, double radius) 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

Signals inherited from QwtAbstractSlider
void | valueChanged (double value)
| Notify a change of value. More...
void | sliderPressed ()
void | sliderReleased ()
void | sliderMoved (double value)

## Detailed Description

An analog clock.

Example
  #include <qwt_analog_clock.h>
  QwtAnalogClock *clock = new QwtAnalogClock(...);
  clock->scaleDraw()->setPenWidth(3);
  clock->setLineWidth(6);
  clock->setFrameShadow(QwtDial::Sunken);
  clock->setTime();
  // update the clock every second
  QTimer *timer = new QTimer(clock);
  timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime()));
  timer->start(1000);

Note
  The examples/dials example shows how to use QwtAnalogClock.

## Member Enumeration Documentation

## Hand

enum QwtAnalogClock::Hand

Hand type

See also
  setHand(), hand()

Enumerator
SecondHand | Needle displaying the seconds.
MinuteHand | Needle displaying the minutes.
HourHand | Needle displaying the hours.
NHands | Number of needles.

## Constructor & Destructor Documentation

## QwtAnalogClock()

QwtAnalogClock::QwtAnalogClock | ( | QWidget * | parent = `NULL` | ) |

explicit

Constructor

Parameters

  parent | Parent widget

## Member Function Documentation

## drawHand()

void QwtAnalogClock::drawHand | ( | QPainter * | painter,
|  | Hand | hd,
|  | const QPointF & | center,
|  | double | radius,
|  | double | direction,
|  | QPalette::ColorGroup | cg
| ) |  | const

protected virtual

Draw a clock hand

Parameters

  painter | Painter
  hd | Specify the type of hand
  center | Center of the clock
  radius | Maximum length for the hands
  direction | Direction of the hand in degrees, counter clockwise
  cg | ColorGroup

## drawNeedle()

void QwtAnalogClock::drawNeedle | ( | QPainter * | painter,
|  | const QPointF & | center,
|  | double | radius,
|  | double | dir,
|  | QPalette::ColorGroup | colorGroup
| ) |  | const

protected virtual

Draw the needle.

A clock has no single needle but three hands instead. drawNeedle() translates value() into directions for the hands and calls drawHand().

Parameters

  painter | Painter
  center | Center of the clock
  radius | Maximum length for the hands
  dir | Dummy, not used.
  colorGroup | ColorGroup

See also
  drawHand()

Reimplemented from QwtDial.

## hand() [1/2]

QwtDialNeedle * QwtAnalogClock::hand | ( | Hand | hd | ) |

Returns
  Clock hand

Parameters

  hd | Specifies the type of hand

See also
  setHand()

## hand() [2/2]

const QwtDialNeedle * QwtAnalogClock::hand | ( | Hand | hd | ) | const

Returns
  Clock hand

Parameters

  hd | Specifies the type of hand

See also
  setHand()

## setHand()

void QwtAnalogClock::setHand | ( | Hand | hand,
|  | QwtDialNeedle * | needle
| ) |  |

Set a clock hand

Parameters

  hand | Specifies the type of hand
  needle | Hand

See also
  hand()

## setTime

void QwtAnalogClock::setTime | ( | const QTime & | time | ) |

slot

Set a time

Parameters

  time | Time to display

QwtDial::Sunken
@ Sunken
QFrame::Sunken.
Definition: qwt_dial.h:81
QwtDial::setLineWidth
void setLineWidth(int)
Definition: qwt_dial.cpp:199
QwtAnalogClock
An analog clock.
Definition: qwt_analog_clock.h:44
QwtDial::scaleDraw
QwtRoundScaleDraw * scaleDraw()
Definition: qwt_dial.cpp:555
QwtAnalogClock::setCurrentTime
void setCurrentTime()
Set the current time.
Definition: qwt_analog_clock.cpp:160
QwtAbstractScaleDraw::setPenWidth
void setPenWidth(int width)
Specify the width of the scale pen.
Definition: qwt_abstract_scale_draw.cpp:142
QwtAnalogClock::QwtAnalogClock
QwtAnalogClock(QWidget *parent=NULL)
Definition: qwt_analog_clock.cpp:44
QwtDial::setFrameShadow
void setFrameShadow(Shadow)
Definition: qwt_dial.cpp:172
QwtAnalogClock::setTime
void setTime(const QTime &)
Definition: qwt_analog_clock.cpp:169