forked from Lighter-z/QtControls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmygauge1.h
60 lines (50 loc) · 1.2 KB
/
mygauge1.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
#ifndef MYGAUGE1_H
#define MYGAUGE1_H
#include <QWidget>
#include <QtGui>
class myGauge1 : public QWidget
{
Q_OBJECT
public:
explicit myGauge1(QWidget *parent = 0);
protected:
void paintEvent(QPaintEvent *);
QSize sizeHint() const
{
return QSize(200,200);
}
QSize minimumSizeHint() const
{
return QSize(150,150);
}
private:
void drawOuterCircle(QPainter* painter);
void drawInnerCircle(QPainter* painter);
void drawColorPies(QPainter* painter);
void drawCoverLines(QPainter* painter);
void drawCoverCircle(QPainter* painter);
void drawMarkAndText(QPainter* painter);
void drawGraph(QPainter* painter);
void drawTextRect(QPainter* painter);
void resetVariables(QPainter* painter);
private:
qreal m_value;
qreal m_outerRadius;
qreal m_innerRadius;
qreal m_colorPieRadius;
qreal m_coverCircleRadius;
qreal m_currentValue;
qreal m_longHand;
qreal m_okHand;
qreal m_shortHand;
qreal m_space;
bool m_bReverse;
QTimer* updateTimer;
QPointF m_center;
QRectF m_pieRect;
public slots:
void setValue(qreal value);
private slots:
void UpdateGraph();
};
#endif // MYGAUGE1_H