source: pacpusframework/branches/2.0-beta1/include/extlib/qwt-5.2.1/qwt_analog_clock.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 2.3 KB
Line 
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 <qdatetime.h>
14#include "qwt_global.h"
15#include "qwt_dial.h"
16#include "qwt_dial_needle.h"
17
18/*!
19 \brief An analog clock
20
21 \image html analogclock.png
22
23 \par Example
24 \verbatim #include <qwt_analog_clock.h>
25
26 QwtAnalogClock *clock = new QwtAnalogClock(...);
27 clock->scaleDraw()->setPenWidth(3);
28 clock->setLineWidth(6);
29 clock->setFrameShadow(QwtDial::Sunken);
30 clock->setTime();
31
32 // update the clock every second
33 QTimer *timer = new QTimer(clock);
34 timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime()));
35 timer->start(1000);
36
37 \endverbatim
38
39 Qwt is missing a set of good looking hands.
40 Contributions are very welcome.
41
42 \note The examples/dials example shows how to use QwtAnalogClock.
43*/
44
45class QWT_EXPORT QwtAnalogClock: public QwtDial
46{
47 Q_OBJECT
48
49public:
50 /*!
51 Hand type
52 \sa setHand(), hand()
53 */
54
55 enum Hand
56 {
57 SecondHand,
58 MinuteHand,
59 HourHand,
60
61 NHands
62 };
63
64 explicit QwtAnalogClock(QWidget* parent = NULL);
65#if QT_VERSION < 0x040000
66 explicit QwtAnalogClock(QWidget* parent, const char *name);
67#endif
68 virtual ~QwtAnalogClock();
69
70 virtual void setHand(Hand, QwtDialNeedle *);
71 const QwtDialNeedle *hand(Hand) const;
72 QwtDialNeedle *hand(Hand);
73
74public slots:
75 void setCurrentTime();
76 void setTime(const QTime & = QTime::currentTime());
77
78protected:
79 virtual QwtText scaleLabel(double) const;
80
81 virtual void drawNeedle(QPainter *, const QPoint &,
82 int radius, double direction, QPalette::ColorGroup) const;
83
84 virtual void drawHand(QPainter *, Hand, const QPoint &,
85 int radius, double direction, QPalette::ColorGroup) const;
86
87private:
88 virtual void setNeedle(QwtDialNeedle *);
89 void initClock();
90
91 QwtDialNeedle *d_hand[NHands];
92};
93
94#endif
Note: See TracBrowser for help on using the repository browser.