-
Notifications
You must be signed in to change notification settings - Fork 9
/
mywave1.h
74 lines (50 loc) · 1.23 KB
/
mywave1.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
#ifndef MYWAVE1_H
#define MYWAVE1_H
#define PYI_HEAD_HEIGHT 1
#define PYI_BAR_START_COLOR QColor(88,177,245)
#define PYI_BAR_END_COLOR QColor(74,149,206)
#define PYI_HEAD_Y_INCREMENT 1
#define PYI_VALUE_DECREMENT 1
#define PYI_EXTRA_SPACE 2
#define PYI_MAX_WIDTH 15
#define DEBUG_VAR(VAR) qDebug() << __FILE__ << ":" << __LINE__ << ":" << __FUNCTION__ << #VAR << ":" << VAR;
#include <QWidget>
#include <QtGui>
class myWave1 : public QWidget
{
Q_OBJECT
public:
explicit myWave1(QWidget *parent = 0);
void setRange(int min,int max);
void setValue(int value);
int minimum() const;
int maximum() const;
int value() const;
protected:
void paintEvent(QPaintEvent *);
QSize sizeHint() const
{
return QSize(20,200);
}
private:
void drawBackground(QPainter* painter);
void drawBar(QPainter* painter);
void drawHead(QPainter* painter);
private:
int m_nMin;
int m_nMax;
int m_nValue;
int m_nCurrentValue;
qreal m_headY;
qreal m_barY;
QTimer* m_shrinkTimer;
QTimer* m_dropTimer;
QTimer* m_toolTimer;
QRectF m_BarRect;
private:
void initVariables();
private slots:
void DoShrinkBar();
void DoDropHead();
};
#endif // MYWAVE1_H