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

An analog clock. More...

#include <qwt_analog_clock.h>

Inheritance diagram for QwtAnalogClock:
Inheritance graph
[legend]

List of all members.

Public Types

enum  Hand { SecondHand, MinuteHand, HourHand, NHands }

Public Slots

void setCurrentTime ()
 Set the current time.
void setTime (const QTime &)

Public Member Functions

const QwtDialNeedlehand (Hand) const
QwtDialNeedlehand (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

QwtDialNeedled_hand [NHands]

Detailed Description

An analog clock.

analogclock.png
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.

Definition at line 43 of file qwt_analog_clock.h.


Member Enumeration Documentation

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.

Definition at line 52 of file qwt_analog_clock.h.


Constructor & Destructor Documentation

QwtAnalogClock::QwtAnalogClock ( QWidget *  parent = NULL) [explicit]

Constructor

Parameters:
parentParent widget

Definition at line 44 of file qwt_analog_clock.cpp.

Destructor.

Definition at line 103 of file qwt_analog_clock.cpp.


Member Function Documentation

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:
painterPainter
hdSpecify the type of hand
centerCenter of the clock
radiusMaximum length for the hands
directionDirection of the hand in degrees, counter clockwise
cgColorGroup

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().

Parameters:
painterPainter
centerCenter of the clock
radiusMaximum length for the hands
dirDummy, not used.
colorGroupColorGroup
See also:
drawHand()

Reimplemented from QwtDial.

Definition at line 195 of file qwt_analog_clock.cpp.

const QwtDialNeedle * QwtAnalogClock::hand ( Hand  hd) const
Returns:
Clock hand
Parameters:
hdSpecifies the type of hand
See also:
setHand()

Definition at line 152 of file qwt_analog_clock.cpp.

Returns:
Clock hand
Parameters:
hdSpecifies the type of hand
See also:
setHand()

Definition at line 139 of file qwt_analog_clock.cpp.

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

Parameters:
handSpecifies the type of hand
needleHand
See also:
hand()

Definition at line 125 of file qwt_analog_clock.cpp.

void QwtAnalogClock::setNeedle ( QwtDialNeedle ) [private]

Nop method, use setHand() instead

See also:
setHand()

Reimplemented from QwtDial.

Definition at line 113 of file qwt_analog_clock.cpp.

void QwtAnalogClock::setTime ( const QTime &  time) [slot]

Set a time

Parameters:
timeTime to display

Definition at line 169 of file qwt_analog_clock.cpp.


Member Data Documentation

Definition at line 90 of file qwt_analog_clock.h.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:57