-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgaugedisplayer.h
64 lines (52 loc) · 1.16 KB
/
gaugedisplayer.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
#ifndef GaugeDisplayer_H
#define GaugeDisplayer_H
#define LONG3 7
#define OK3 5
#define SHORT3 3
#define MARK_BUCKET_SPACE3 20
#include <QWidget>
#include <QtGui>
class GaugeDisplayer : public QWidget
{
Q_OBJECT
public:
explicit GaugeDisplayer(QWidget *parent = 0);
~GaugeDisplayer();
void SetGraphColor(QColor c);
protected:
void paintEvent(QPaintEvent *);
QSize sizeHint() const
{
return QSize(300,300);
}
QSize minimumSizeHint() const
{
return QSize(200,200);
}
private:
void drawMark(QPainter* painter);
void drawBucket(QPainter* painter);
void drawBackground(QPainter* painter);
void drawGraph(QPainter* painter);
void resetDrawingVariables();
private:
qreal m_value;
qreal m_currentValue;
qreal m_bucketWidth;
QTimer* updateTimer;
bool m_bReverse;
qreal m_markSpace;
qreal m_topSpace;
QColor m_markClr;
QColor graphcolor;
QRectF m_bucketRect;
private:
void initVariables();
signals:
private slots:
void UpdateGraph();
public slots:
void setValue(qreal value);
void setMarkColor(const QColor& clr);
};
#endif // GaugeDisplayer_H