QwtAnalogClock(3) Qwt User's Guide QwtAnalogClock(3)

QwtAnalogClock - An analog clock.

#include <qwt_analog_clock.h>

Inherits QwtDial.


enum Hand { SecondHand, MinuteHand, HourHand, NHands }


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


QwtAnalogClock (QWidget *parent=NULL)
virtual ~QwtAnalogClock ()
Destructor. void setHand (Hand, QwtDialNeedle *)
const QwtDialNeedle * hand (Hand) const
QwtDialNeedle * hand (Hand)


virtual void drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const override
Draw the needle. virtual void drawHand (QPainter *, Hand, const QPointF &, double radius, double direction, QPalette::ColorGroup) const

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.

Definition at line 43 of file qwt_analog_clock.h.

Hand type

See also

setHand(), hand()

Enumerator

Needle displaying the seconds.
Needle displaying the minutes.
Needle displaying the hours.
Number of needles.

Definition at line 52 of file qwt_analog_clock.h.

Constructor

Parameters

parent Parent widget

Definition at line 51 of file qwt_analog_clock.cpp.

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

Definition at line 239 of file qwt_analog_clock.cpp.

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.
colorGroup ColorGroup

See also

drawHand()

Reimplemented from QwtDial.

Definition at line 202 of file qwt_analog_clock.cpp.

QwtDialNeedle * QwtAnalogClock::hand (Hand hd)

Returns

Clock hand

Parameters

hd Specifies the type of hand

See also

setHand()

Definition at line 146 of file qwt_analog_clock.cpp.

Returns

Clock hand

Parameters

hd Specifies the type of hand

See also

setHand()

Definition at line 159 of file qwt_analog_clock.cpp.

Set a clock hand

Parameters

hand Specifies the type of hand
needle Hand

See also

hand()

Definition at line 132 of file qwt_analog_clock.cpp.

Set a time

Parameters

time Time to display

Definition at line 176 of file qwt_analog_clock.cpp.

Generated automatically by Doxygen for Qwt User's Guide from the source code.

Sun Jul 18 2021 Version 6.2.0