-
Notifications
You must be signed in to change notification settings - Fork 9
/
myindicator.h
67 lines (53 loc) · 1.29 KB
/
myindicator.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
#ifndef MYINDICATOR_H
#define MYINDICATOR_H
#include <QWidget>
#include <QtGui>
#include "mylcdnumber.h"
const int INDICATOR_COUNT = 3;
const int INDICATOR_PEN_WIDTH = 2;
const QColor INDICATOR_FRAME_COLOR = QColor(255,170,0);
const QColor INDICATOR_GRAPH_COLOR = QColor(85,255,0);
class myIndicator : public QWidget
{
Q_OBJECT
public:
explicit myIndicator(QWidget *parent = 0);
void SetForeColor(QColor c);
protected:
QSize sizeHint() const
{
return QSize(70,300);
}
QSize minimumSizeHint() const
{
return QSize(80,200);
}
void paintEvent(QPaintEvent *);
private:
void drawVariables(QPainter* painter);
void drawBackground(QPainter* painter);
void drawLCDNums(QPainter* painter);
void drawRect(QPainter* painter);
void drawBars(QPainter* painter);
void drawGraph(QPainter* painter);
private:
void initVariables();
private:
myLCDNumber* lcd[INDICATOR_COUNT];
qreal m_leftSpace;
qreal m_topSpace;
qreal m_lcdWidth;
qreal m_lcdHeight;
int m_value;
int m_currValue;
bool m_bReverse;
QTimer* updateTimer;
QPointF m_rectTopLeft;
QPointF m_rectBottomRight;
QColor forecolor;
private slots:
void UpdateData();
public slots:
void setValue(int value);
};
#endif // MYINDICATOR_H