Public Types | Public Slots | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
QwtAnalogClock Class Reference

An analog clock. More...

#include <qwt_analog_clock.h>

Inheritance diagram for QwtAnalogClock:
Inheritance graph
[legend]

Public Types

enum  Hand { SecondHand, MinuteHand, HourHand, NHands }
 
- Public Types inherited from QwtDial
enum  Mode { RotateNeedle, RotateScale }
 Mode controlling whether the needle or the scale is rotating. More...
 
enum  Shadow { Plain = QFrame::Plain, Raised = QFrame::Raised, Sunken = QFrame::Sunken }
 Frame shadow. More...
 

Public Slots

void setCurrentTime ()
 Set the current time. More...
 
void setTime (const QTime &)
 
- Public Slots inherited from QwtAbstractSlider
void setValue (double value)
 

Public Member Functions

QwtDialNeedlehand (Hand)
 
const QwtDialNeedlehand (Hand) const
 
 QwtAnalogClock (QWidget *parent=NULL)
 
void setHand (Hand, QwtDialNeedle *)
 
virtual ~QwtAnalogClock ()
 Destructor. More...
 
- Public Member Functions inherited from QwtDial
QRect boundingRect () const
 
Shadow frameShadow () const
 
QRect innerRect () const
 
int lineWidth () const
 
double maxScaleArc () const
 
virtual QSize minimumSizeHint () const QWT_OVERRIDE
 
double minScaleArc () const
 
Mode mode () const
 
QwtDialNeedleneedle ()
 
const QwtDialNeedleneedle () const
 
double origin () const
 
 QwtDial (QWidget *parent=NULL)
 Constructor. More...
 
QwtRoundScaleDrawscaleDraw ()
 
const QwtRoundScaleDrawscaleDraw () const
 
virtual QRect scaleInnerRect () const
 
void setFrameShadow (Shadow)
 
void setLineWidth (int)
 
void setMaxScaleArc (double)
 
void setMinScaleArc (double)
 
void setMode (Mode)
 Change the mode of the dial. More...
 
void setNeedle (QwtDialNeedle *)
 
virtual void setOrigin (double)
 Change the origin. More...
 
void setScaleArc (double minArc, double maxArc)
 
void setScaleDraw (QwtRoundScaleDraw *)
 
virtual QSize sizeHint () const QWT_OVERRIDE
 
virtual ~QwtDial ()
 Destructor. More...
 
- Public Member Functions inherited from QwtAbstractSlider
bool invertedControls () const
 
bool isReadOnly () const
 
bool isTracking () const
 
bool isValid () const
 
uint pageSteps () const
 
 QwtAbstractSlider (QWidget *parent=NULL)
 Constructor. More...
 
void setInvertedControls (bool)
 
void setPageSteps (uint)
 Set the number of steps for a page increment. More...
 
void setReadOnly (bool)
 
void setSingleSteps (uint)
 Set the number of steps for a single increment. More...
 
void setStepAlignment (bool)
 Enable step alignment. More...
 
void setTotalSteps (uint)
 Set the number of steps. More...
 
void setTracking (bool)
 Enables or disables tracking. More...
 
void setValid (bool)
 
void setWrapping (bool)
 
uint singleSteps () const
 
bool stepAlignment () const
 
uint totalSteps () const
 
double value () const
 
bool wrapping () const
 
virtual ~QwtAbstractSlider ()
 Destructor. More...
 
- Public Member Functions inherited from QwtAbstractScale
double invTransform (int) const
 
bool isInverted () const
 
double lowerBound () const
 
double maximum () const
 
double minimum () const
 
 QwtAbstractScale (QWidget *parent=NULL)
 
const QwtScaleDivscaleDiv () const
 
QwtScaleEnginescaleEngine ()
 
const QwtScaleEnginescaleEngine () const
 
const QwtScaleMapscaleMap () const
 
int scaleMaxMajor () const
 
int scaleMaxMinor () const
 
double scaleStepSize () const
 
void setLowerBound (double value)
 
void setScale (const QwtInterval &)
 Specify a scale. More...
 
void setScale (const QwtScaleDiv &)
 Specify a scale. More...
 
void setScale (double lowerBound, double upperBound)
 Specify a scale. More...
 
void setScaleEngine (QwtScaleEngine *)
 Set a scale engine. More...
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals. More...
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals. More...
 
void setScaleStepSize (double stepSize)
 Set the step size used for calculating a scale division. More...
 
void setUpperBound (double value)
 
int transform (double) const
 
double upperBound () const
 
virtual ~QwtAbstractScale ()
 Destructor. More...
 

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 QWT_OVERRIDE
 Draw the needle. More...
 
- Protected Member Functions inherited from QwtDial
virtual void changeEvent (QEvent *) QWT_OVERRIDE
 
virtual void drawContents (QPainter *) const
 Draw the contents inside the frame. More...
 
virtual void drawFocusIndicator (QPainter *) const
 
virtual void drawFrame (QPainter *)
 
virtual void drawScale (QPainter *, const QPointF &center, double radius) const
 
virtual void drawScaleContents (QPainter *painter, const QPointF &center, double radius) const
 
void invalidateCache ()
 
virtual bool isScrollPosition (const QPoint &) const QWT_OVERRIDE
 Determine what to do when the user presses a mouse button. More...
 
virtual void paintEvent (QPaintEvent *) QWT_OVERRIDE
 
virtual void scaleChange () QWT_OVERRIDE
 
virtual double scrolledTo (const QPoint &) const QWT_OVERRIDE
 Determine the value for a new position of the slider handle. More...
 
virtual void sliderChange () QWT_OVERRIDE
 Calling update() More...
 
virtual void wheelEvent (QWheelEvent *) QWT_OVERRIDE
 
- Protected Member Functions inherited from QwtAbstractSlider
double incrementedValue (double value, int stepCount) const
 
void incrementValue (int stepCount)
 
virtual void keyPressEvent (QKeyEvent *) QWT_OVERRIDE
 
virtual void mouseMoveEvent (QMouseEvent *) QWT_OVERRIDE
 
virtual void mousePressEvent (QMouseEvent *) QWT_OVERRIDE
 
virtual void mouseReleaseEvent (QMouseEvent *) QWT_OVERRIDE
 
- Protected Member Functions inherited from QwtAbstractScale
QwtAbstractScaleDrawabstractScaleDraw ()
 
const QwtAbstractScaleDrawabstractScaleDraw () const
 
void rescale (double lowerBound, double upperBound, double stepSize)
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set a scale draw. More...
 
void updateScaleDraw ()
 

Private Member Functions

void setNeedle (QwtDialNeedle *)
 

Private Attributes

QwtDialNeedlem_hand [NHands]
 

Additional Inherited Members

- Signals inherited from QwtAbstractSlider
void sliderMoved (double value)
 
void sliderPressed ()
 
void sliderReleased ()
 
void valueChanged (double value)
 Notify a change of value. More...
 
- Properties inherited from QwtDial
Shadow frameShadow
 
int lineWidth
 
double maxScaleArc
 
double minScaleArc
 
Mode mode
 
double origin
 
- Properties inherited from QwtAbstractSlider
bool invertedControls
 
uint pageSteps
 
bool readOnly
 
uint singleSteps
 
bool stepAlignment
 
uint totalSteps
 
bool tracking
 
double value
 Returns the current value. More...
 
bool wrapping
 
- Properties inherited from QwtAbstractScale
double lowerBound
 
int scaleMaxMajor
 
int scaleMaxMinor
 
double scaleStepSize
 
double upperBound
 

Detailed Description

An analog clock.

Example
QwtAnalogClock *clock = new QwtAnalogClock(...);
clock->scaleDraw()->setPenWidth(3);
clock->setLineWidth(6);
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

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::QwtAnalogClock ( QWidget *  parent = NULL)
explicit

Constructor

Parameters
parentParent widget

Definition at line 51 of file qwt_analog_clock.cpp.

◆ ~QwtAnalogClock()

QwtAnalogClock::~QwtAnalogClock ( )
virtual

Destructor.

Definition at line 110 of file qwt_analog_clock.cpp.

Member Function Documentation

◆ drawHand()

void QwtAnalogClock::drawHand ( QPainter *  painter,
Hand  hd,
const QPointF &  center,
double  radius,
double  direction,
QPalette::ColorGroup  cg 
) const
protectedvirtual

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 239 of file qwt_analog_clock.cpp.

◆ drawNeedle()

void QwtAnalogClock::drawNeedle ( QPainter *  painter,
const QPointF &  center,
double  radius,
double  direction,
QPalette::ColorGroup  colorGroup 
) const
protectedvirtual

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
directionDummy, not used.
colorGroupColorGroup
See also
drawHand()

Reimplemented from QwtDial.

Definition at line 202 of file qwt_analog_clock.cpp.

◆ hand() [1/2]

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

Definition at line 146 of file qwt_analog_clock.cpp.

◆ hand() [2/2]

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

Definition at line 159 of file qwt_analog_clock.cpp.

◆ setCurrentTime

void QwtAnalogClock::setCurrentTime ( )
slot

Set the current time.

Definition at line 167 of file qwt_analog_clock.cpp.

◆ setHand()

void QwtAnalogClock::setHand ( Hand  hand,
QwtDialNeedle needle 
)

Set a clock hand

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

Definition at line 132 of file qwt_analog_clock.cpp.

◆ setNeedle()

void QwtAnalogClock::setNeedle ( QwtDialNeedle )
private

Nop method, use setHand() instead

See also
setHand()

Definition at line 120 of file qwt_analog_clock.cpp.

◆ setTime

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

Set a time

Parameters
timeTime to display

Definition at line 176 of file qwt_analog_clock.cpp.

Member Data Documentation

◆ m_hand

QwtDialNeedle* QwtAnalogClock::m_hand[NHands]
private

Definition at line 90 of file qwt_analog_clock.h.


The documentation for this class was generated from the following files:
qwt_analog_clock.h
QwtDial::setFrameShadow
void setFrameShadow(Shadow)
Definition: qwt_dial.cpp:170
QwtAnalogClock::setTime
void setTime(const QTime &)
Definition: qwt_analog_clock.cpp:176
QwtAnalogClock::setCurrentTime
void setCurrentTime()
Set the current time.
Definition: qwt_analog_clock.cpp:167
QwtDial::scaleDraw
QwtRoundScaleDraw * scaleDraw()
Definition: qwt_dial.cpp:553
QwtDial::Sunken
@ Sunken
QFrame::Sunken.
Definition: qwt_dial.h:82
QwtAnalogClock::QwtAnalogClock
QwtAnalogClock(QWidget *parent=NULL)
Definition: qwt_analog_clock.cpp:51
QwtDial::setLineWidth
void setLineWidth(int)
Definition: qwt_dial.cpp:197
QwtAnalogClock
An analog clock.
Definition: qwt_analog_clock.h:43


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:50