-
Notifications
You must be signed in to change notification settings - Fork 3
/
learngaugedisplayer.h
82 lines (68 loc) · 1.56 KB
/
learngaugedisplayer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef LEARNGAUGEDISPLAYER_H
#define LEARNGAUGEDISPLAYER_H
#define LONG1 10
#define OK1 7
#define SHORT1 5
#define SPACE1 3
#define ANGLE1 10
#include <QWidget>
#include <QtGui>
class LearnGaugeDisplayer : public QWidget
{
Q_OBJECT
public:
explicit LearnGaugeDisplayer(QWidget *parent = 0);
~LearnGaugeDisplayer();
signals:
public slots:
void setValue(qreal value);
void setAnimating(bool enable)
{
m_bAnimating=enable;
update();
}
public:
bool isAnimating() const
{
return m_bAnimating;
}
protected:
void paintEvent(QPaintEvent *);
QSize sizeHint() const
{
return QSize(300,300);
}
QSize minimumSizeHint() const
{
return QSize(200,200);
}
private:
void drawOuterCircle(QPainter* painter);
void drawInnerCircle(QPainter* painter);
void drawMark(QPainter* painter);
void drawCoverCircle(QPainter* painter);
void drawColorPie(QPainter* painter);
void drawIndicator(QPainter* painter);
void drawCoverBall(QPainter* painter);
void resetVariables();
void drawTextRect(QPainter* painter);
private:
qreal m_outerRadius;
qreal m_innerRadius;
qreal m_coverCircleRadius;
qreal m_colorCircleRadius;
qreal m_coverBallRadius;
QPointF m_center;
QRectF m_colorCircleRect;
qreal m_value;
QTimer* updateTimer;
bool m_bReverse;
qreal m_currentValue;
QTimer* singleTimer;
bool m_bAnimating;
private:
void initVariables();
private slots:
void UpdateGraph();
};
#endif // LEARNGAUGEDISPLAYER_H