NAME
QwtAnalogClock -
SYNOPSIS
Inherits QwtDial.
Detailed Description
An analog clock.
Example.RS 4
#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.
Public Types
enum Hand { SecondHand, MinuteHand, HourHand, NHands }
Public Slots
void setCurrentTime ()
void setTime (const QTime &=QTime::currentTime())
Public Member Functions
QwtAnalogClock (QWidget *parent=0, const char *name=0)
virtual ~QwtAnalogClock ()
virtual void setHand (Hand, QwtDialNeedle *)
const QwtDialNeedle * hand (Hand) const
QwtDialNeedle * hand (Hand)
Protected Member Functions
virtual QString scaleLabel (double) const
virtual void drawNeedle (QPainter *, const QPoint &, int radius, double
direction, QPalette::ColorGroup) const
virtual void drawHand (QPainter *, Hand, const QPoint &, int radius,
double direction, QPalette::ColorGroup) const
Constructor & Destructor Documentation
QwtAnalogClock::QwtAnalogClock (QWidget * parent = 0, const char * name =
0)
Constructor
Parameters:
parent Parent widget
name Widget name
Definition at line 8 of file qwt_analog_clock.cpp.
References hand(), setHand(), QwtDial::setOrigin(),
QwtDblRange::setRange(), QwtSliderBase::setReadOnly(),
QwtDial::setScale(), QwtDial::setScaleOptions(),
QwtDial::setScaleTicks(), QwtDialSimpleNeedle::setWidth(), and
QwtDial::setWrapping().
QwtAnalogClock::~QwtAnalogClock () [virtual]
Destructor.
Definition at line 50 of file qwt_analog_clock.cpp.
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
Definition at line 191 of file qwt_analog_clock.cpp.
References QwtDialNeedle::draw(), and hand().
Referenced by drawNeedle().
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:
QwtAnalogClock::drawHand()
Reimplemented from QwtDial.
Definition at line 162 of file qwt_analog_clock.cpp.
References drawHand(), QwtSliderBase::isValid(), QwtDial::origin(), and
QwtDblRange::value().
QwtDialNeedle * QwtAnalogClock::hand (Hand hd)
Returns:
Clock hand
Parameters:
hd Specifies the type of hand
See also:
QwtAnalogClock::setHand
Definition at line 86 of file qwt_analog_clock.cpp.
const QwtDialNeedle * QwtAnalogClock::hand (Hand hd) const
Returns:
Clock hand
Parameters:
hd Specifies the type of hand
See also:
QwtAnalogClock::setHand
Definition at line 99 of file qwt_analog_clock.cpp.
Referenced by drawHand(), and QwtAnalogClock().
QString QwtAnalogClock::scaleLabel (double value) const [protected,
virtual]
Find the scale label for a given value
Parameters:
value Value
Returns:
Label
Reimplemented from QwtDial.
Definition at line 136 of file qwt_analog_clock.cpp.
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. Definition at line 110 of file
qwt_analog_clock.cpp.
References setTime().
void QwtAnalogClock::setHand (Hand hand, QwtDialNeedle * needle) [virtual]
Set a clockhand
Parameters:
hand Specifies the type of hand
needle Hand
See also:
QwtAnalogClock::hand()
Definition at line 72 of file qwt_analog_clock.cpp.
Referenced by QwtAnalogClock().
void QwtAnalogClock::setTime (const QTime & time = QTime::currentTime())
[slot]
Set a time
Parameters:
time Time to display
Definition at line 119 of file qwt_analog_clock.cpp.
References QwtSliderBase::setValid(), and QwtSliderBase::setValue().
Referenced by setCurrentTime().
Author
Generated automatically by Doxygen for Qwt User’s Guide from the source
code.