An analog clock. More...
#include <qwt_analog_clock.h>

Public Types | |
| enum | Hand { SecondHand, MinuteHand, HourHand, NHands } |
Public Slots | |
| void | setCurrentTime () |
| Set the current time. | |
| void | setTime (const QTime &) |
Public Member Functions | |
| const QwtDialNeedle * | hand (Hand) const |
| QwtDialNeedle * | hand (Hand) |
| QwtAnalogClock (QWidget *parent=NULL) | |
| void | setHand (Hand, QwtDialNeedle *) |
| virtual | ~QwtAnalogClock () |
| Destructor. | |
Protected Member Functions | |
| virtual void | drawHand (QPainter *, Hand, const QPointF &, double radius, double direction, QPalette::ColorGroup) const |
| virtual void | drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const |
| Draw the needle. | |
Private Member Functions | |
| void | setNeedle (QwtDialNeedle *) |
Private Attributes | |
| QwtDialNeedle * | d_hand [NHands] |
An analog clock.
#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);
Definition at line 43 of file qwt_analog_clock.h.
| enum QwtAnalogClock::Hand |
Hand type
| SecondHand |
Needle displaying the seconds. |
| MinuteHand |
Needle displaying the minutes. |
| HourHand |
Needle displaying the hours. |
| NHands |
Number of needles. |
Definition at line 52 of file qwt_analog_clock.h.
| QwtAnalogClock::QwtAnalogClock | ( | QWidget * | parent = NULL | ) | [explicit] |
| QwtAnalogClock::~QwtAnalogClock | ( | ) | [virtual] |
Destructor.
Definition at line 103 of file qwt_analog_clock.cpp.
| void QwtAnalogClock::drawHand | ( | QPainter * | painter, |
| Hand | hd, | ||
| const QPointF & | center, | ||
| double | radius, | ||
| double | direction, | ||
| QPalette::ColorGroup | cg | ||
| ) | const [protected, virtual] |
Draw a clock hand
| 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 |
Definition at line 232 of file qwt_analog_clock.cpp.
| 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().
| painter | Painter |
| center | Center of the clock |
| radius | Maximum length for the hands |
| dir | Dummy, not used. |
| colorGroup | ColorGroup |
Reimplemented from QwtDial.
Definition at line 195 of file qwt_analog_clock.cpp.
| const QwtDialNeedle * QwtAnalogClock::hand | ( | Hand | hd | ) | const |
| hd | Specifies the type of hand |
Definition at line 152 of file qwt_analog_clock.cpp.
| QwtDialNeedle * QwtAnalogClock::hand | ( | Hand | hd | ) |
| hd | Specifies the type of hand |
Definition at line 139 of file qwt_analog_clock.cpp.
| void QwtAnalogClock::setCurrentTime | ( | ) | [slot] |
Set the current time.
Definition at line 160 of file qwt_analog_clock.cpp.
| void QwtAnalogClock::setHand | ( | Hand | hand, |
| QwtDialNeedle * | needle | ||
| ) |
Set a clock hand
| hand | Specifies the type of hand |
| needle | Hand |
Definition at line 125 of file qwt_analog_clock.cpp.
| void QwtAnalogClock::setNeedle | ( | QwtDialNeedle * | ) | [private] |
Nop method, use setHand() instead
Reimplemented from QwtDial.
Definition at line 113 of file qwt_analog_clock.cpp.
| void QwtAnalogClock::setTime | ( | const QTime & | time | ) | [slot] |
QwtDialNeedle* QwtAnalogClock::d_hand[NHands] [private] |
Definition at line 90 of file qwt_analog_clock.h.