source: ntrip/trunk/BNC/qwt/qwt_analog_clock.h@ 8941

Last change on this file since 8941 was 8127, checked in by stoecker, 8 years ago

update qwt and qwtpolar, many QT5 fixes (unfinished)

File size: 2.1 KB
RevLine 
[8127]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
18/*!
19 \brief An analog clock
20
21 \image html analogclock.png
22
23 \par Example
24 \code
25 #include <qwt_analog_clock.h>
26
27 QwtAnalogClock *clock = new QwtAnalogClock(...);
28 clock->scaleDraw()->setPenWidth(3);
29 clock->setLineWidth(6);
30 clock->setFrameShadow(QwtDial::Sunken);
31 clock->setTime();
32
33 // update the clock every second
34 QTimer *timer = new QTimer(clock);
35 timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime()));
36 timer->start(1000);
37
38 \endcode
39
40 \note The examples/dials example shows how to use QwtAnalogClock.
41*/
42
43class QWT_EXPORT QwtAnalogClock: public QwtDial
44{
45 Q_OBJECT
46
47public:
48 /*!
49 Hand type
50 \sa setHand(), hand()
51 */
52 enum Hand
53 {
54 //! Needle displaying the seconds
55 SecondHand,
56
57 //! Needle displaying the minutes
58 MinuteHand,
59
60 //! Needle displaying the hours
61 HourHand,
62
63 //! Number of needles
64 NHands
65 };
66
67 explicit QwtAnalogClock( QWidget* parent = NULL );
68 virtual ~QwtAnalogClock();
69
70 void setHand( Hand, QwtDialNeedle * );
71
72 const QwtDialNeedle *hand( Hand ) const;
73 QwtDialNeedle *hand( Hand );
74
75public Q_SLOTS:
76 void setCurrentTime();
77 void setTime( const QTime & );
78
79protected:
80 virtual void drawNeedle( QPainter *, const QPointF &,
81 double radius, double direction, QPalette::ColorGroup ) const;
82
83 virtual void drawHand( QPainter *, Hand, const QPointF &,
84 double radius, double direction, QPalette::ColorGroup ) const;
85
86private:
87 // use setHand instead
88 void setNeedle( QwtDialNeedle * );
89
90 QwtDialNeedle *d_hand[NHands];
91};
92
93#endif
Note: See TracBrowser for help on using the repository browser.