-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqvumeter.h
executable file
·129 lines (106 loc) · 3.53 KB
/
qvumeter.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/***************************************************************************
* Copyright (C) 2008 - Giuseppe Cigala *
* g_cigala@virgilio.it *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef QVUMETER_H
#define QVUMETER_H
#include <QtGui>
#include <QtDesigner/QDesignerExportWidget>
#include <math.h>
class QDESIGNER_WIDGET_EXPORT QVUMeter : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor colorBg READ colorBg WRITE setColorBg);
Q_PROPERTY(QColor colorValue READ colorValue WRITE setColorValue);
Q_PROPERTY(QColor colorLow READ colorLow WRITE setColorLow);
Q_PROPERTY(QColor colorHigh READ colorHigh WRITE setColorHigh);
Q_PROPERTY(double leftValue READ leftValue WRITE setLeftValue);
Q_PROPERTY(double rightValue READ rightValue WRITE setRightValue);
Q_PROPERTY(double minValue READ minValue WRITE setMinValue);
Q_PROPERTY(double maxValue READ maxValue WRITE setMaxValue);
Q_PROPERTY(int dimValue READ valueDim WRITE setValueDim);
QColor colorBg() const
{
return colBack;
}
QColor colorValue() const
{
return colValue;
}
QColor colorLow() const
{
return colLow;
}
QColor colorHigh() const
{
return colHigh;
}
double leftValue() const
{
return leftVal;
}
double rightValue() const
{
return rightVal;
}
double minValue() const
{
return min;
}
double maxValue() const
{
return max;
}
int valueDim() const
{
return dimVal;
}
public:
QVUMeter(QWidget *parent = 0);
QSize minimumSizeHint() const;
QSize sizeHint() const;
signals:
void valueLChanged(double);
void valueRChanged(double);
public slots:
void setColorBg(QColor);
void setColorValue(QColor);
void setColorHigh(QColor);
void setColorLow(QColor);
void setValueDim(int);
void setLeftValue(double);
void setRightValue(double);
void setMinValue(double);
void setMaxValue(double);
protected:
void paintEvent(QPaintEvent *);
void paintBorder();
void paintBar();
void paintValue();
private:
double min;
double max;
double leftVal;
double rightVal;
int dimVal;
QColor colBack;
QColor colValue;
QColor colHigh;
QColor colLow;
};
#endif