Qwt User's Guide 5.2.3

- Main Page
- Related Pages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Slots | Public Member Functions | Protected Member Functions
QwtAnalogClock Class Reference

`#include <qwt_analog_clock.h>`

Inheritance diagram for QwtAnalogClock:
[legend]

List of all members.

## Public Types
enum | Hand { SecondHand, MinuteHand, HourHand, NHands }
Public Types inherited from QwtDial
enum | Direction { Clockwise, CounterClockwise }
enum | Mode { RotateNeedle, RotateScale }
enum | ScaleOptions { ScaleBackbone = 1, ScaleTicks = 2, ScaleLabel = 4 }
enum | Shadow { Plain = QFrame::Plain, Raised = QFrame::Raised, Sunken = QFrame::Sunken }
Public Types inherited from QwtAbstractSlider
enum | ScrollMode { ScrNone, ScrMouse, ScrTimer, ScrDirect, ScrPage }

## Public Slots
void | setCurrentTime ()
void | setTime (const QTime &=QTime::currentTime())

## Public Member Functions
| QwtAnalogClock (QWidget *parent=NULL)
virtual | ~QwtAnalogClock ()
const QwtDialNeedle * | hand (Hand) const
QwtDialNeedle * | hand (Hand)
virtual void | setHand (Hand, QwtDialNeedle *)
Public Member Functions inherited from QwtDial
| QwtDial (QWidget *parent=NULL)
virtual | ~QwtDial ()
QRect | boundingRect () const
QRect | contentsRect () const
Direction | direction () const
Shadow | frameShadow () const
bool | hasVisibleBackground () const
int | lineWidth () const
double | maxScaleArc () const
virtual QSize | minimumSizeHint () const
double | minScaleArc () const
Mode | mode () const
const QwtDialNeedle * | needle () const
QwtDialNeedle * | needle ()
double | origin () const
virtual QRect | scaleContentsRect () const
QwtDialScaleDraw * | scaleDraw ()
const QwtDialScaleDraw * | scaleDraw () const
void | setDirection (Direction)
void | setFrameShadow (Shadow)
void | setLineWidth (int)
void | setMode (Mode)
virtual void | setOrigin (double)
virtual void | setScale (int maxMajIntv, int maxMinIntv, double step=0.0)
void | setScaleArc (double min, double max)
virtual void | setScaleDraw (QwtDialScaleDraw *)
void | setScaleOptions (int)
void | setScaleTicks (int minLen, int medLen, int majLen, int penWidth=1)
virtual void | setWrapping (bool)
void | showBackground (bool)
virtual QSize | sizeHint () const
bool | wrapping () const
Public Member Functions inherited from QwtAbstractSlider
| QwtAbstractSlider (Qt::Orientation, QWidget *parent=NULL)
virtual | ~QwtAbstractSlider ()
bool | isReadOnly () const
bool | isValid () const
virtual double | mass () const
Qt::Orientation | orientation () const
virtual void | setMass (double val)
virtual void | setOrientation (Qt::Orientation o)
void | setTracking (bool enable)
void | setUpdateTime (int t)
void | setValid (bool valid)
void | stopMoving ()
Public Member Functions inherited from QwtDoubleRange
| QwtDoubleRange ()
virtual | ~QwtDoubleRange ()
virtual void | incPages (int)
double | maxValue () const
double | minValue () const
int | pageSize () const
bool | periodic () const
void | setPeriodic (bool tf)
void | setRange (double vmin, double vmax, double vstep=0.0, int pagesize=1)
void | setStep (double)
double | step () const
double | value () const

## Protected Member Functions
virtual void | drawHand (QPainter *, Hand, const QPoint &, int radius, double direction, QPalette::ColorGroup) const
virtual void | drawNeedle (QPainter *, const QPoint &, int radius, double direction, QPalette::ColorGroup) const
virtual QwtText | scaleLabel (double) const
Protected Member Functions inherited from QwtDial
virtual void | drawContents (QPainter *) const
virtual void | drawFocusIndicator (QPainter *) const
virtual void | drawFrame (QPainter *p)
virtual void | drawScale (QPainter *, const QPoint &center, int radius, double origin, double arcMin, double arcMax) const
virtual void | drawScaleContents (QPainter *painter, const QPoint &center, int radius) const
virtual void | getScrollMode (const QPoint &, int &scrollMode, int &direction)
virtual double | getValue (const QPoint &)
virtual void | keyPressEvent (QKeyEvent *)
virtual void | paintEvent (QPaintEvent *)
virtual void | rangeChange ()
virtual void | resizeEvent (QResizeEvent *)
virtual void | updateMask ()
void | updateScale ()
virtual void | valueChange ()
Protected Member Functions inherited from QwtAbstractSlider
virtual void | mouseMoveEvent (QMouseEvent *e)
double | mouseOffset () const
virtual void | mousePressEvent (QMouseEvent *e)
virtual void | mouseReleaseEvent (QMouseEvent *e)
int | scrollMode () const
void | setMouseOffset (double)
virtual void | setPosition (const QPoint &)
virtual void | timerEvent (QTimerEvent *e)
virtual void | wheelEvent (QWheelEvent *e)
Protected Member Functions inherited from QwtDoubleRange
double | exactPrevValue () const
double | exactValue () const
double | prevValue () const
virtual void | stepChange ()

## 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);

Qwt is missing a set of good looking hands. Contributions are very welcome.

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

## Member Enumeration Documentation

enum QwtAnalogClock::Hand

Hand type

See also:
  setHand(), hand()

## Constructor & Destructor Documentation

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

Constructor

Parameters:

  parent | Parent widget

## Member Function Documentation

void QwtAnalogClock::drawHand | ( | QPainter * | painter,
|  | Hand | hd,
|  | const QPoint & | center,
|  | int | 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

void QwtAnalogClock::drawNeedle | ( | QPainter * | painter,
|  | const QPoint & | center,
|  | int | radius,
|  | double | direction,
|  | QPalette::ColorGroup | cg
| ) |  | 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
  direction | Dummy, not used.
  cg | ColorGroup

See also:
  drawHand()

Reimplemented from QwtDial.

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

Returns:
  Clock hand

Parameters:

  hd | Specifies the type of hand

See also:
  setHand()

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

Returns:
  Clock hand

Parameters:

  hd | Specifies the type of hand

See also:
  setHand()

QwtText QwtAnalogClock::scaleLabel | ( | double | value | ) | const
| protected virtual

Find the scale label for a given value

Parameters:

  value | Value

Returns:
  Label

Reimplemented from QwtDial.

void QwtAnalogClock::setCurrentTime | ( |  | ) |
| slot

Set the current time.

This is the same as QwtAnalogClock::setTime(), but Qt < 3.0 can't handle default parameters for slots.

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

Set a clockhand

Parameters:

  hand | Specifies the type of hand
  needle | Hand

See also:
  hand()

void QwtAnalogClock::setTime | ( | const QTime & | time = `QTime::currentTime()` | ) |
| slot

Set a time

Parameters:

  time | Time to display