Qwt User's Guide  6.0.2
qwt_analog_clock.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_ANALOG_CLOCK_H
11 #define QWT_ANALOG_CLOCK_H
12 
13 #include "qwt_global.h"
14 #include "qwt_dial.h"
15 #include "qwt_dial_needle.h"
16 #include <qdatetime.h>
17 
45 class QWT_EXPORT QwtAnalogClock: public QwtDial
46 {
47  Q_OBJECT
48 
49 public:
54  enum Hand
55  {
58 
61 
64 
66  NHands
67  };
68 
69  explicit QwtAnalogClock( QWidget* parent = NULL );
70  virtual ~QwtAnalogClock();
71 
72  virtual void setHand( Hand, QwtDialNeedle * );
73  const QwtDialNeedle *hand( Hand ) const;
74  QwtDialNeedle *hand( Hand );
75 
76 public Q_SLOTS:
77  void setCurrentTime();
78  void setTime( const QTime & = QTime::currentTime() );
79 
80 protected:
81  virtual QwtText scaleLabel( double ) const;
82 
83  virtual void drawNeedle( QPainter *, const QPointF &,
84  double radius, double direction, QPalette::ColorGroup ) const;
85 
86  virtual void drawHand( QPainter *, Hand, const QPointF &,
87  double radius, double direction, QPalette::ColorGroup ) const;
88 
89 private:
90  virtual void setNeedle( QwtDialNeedle * );
91  void initClock();
92 
93  QwtDialNeedle *d_hand[NHands];
94 };
95 
96 #endif