-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathroundprogressbar.h
More file actions
60 lines (47 loc) · 1.07 KB
/
roundprogressbar.h
File metadata and controls
60 lines (47 loc) · 1.07 KB
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 ROUNDPROGRESSBAR_H
#define ROUNDPROGRESSBAR_H
#include <QWidget>
class RoundProgressBar : public QWidget
{
Q_OBJECT
Q_PROPERTY(int _value READ _getValue WRITE _setValue)
public:
enum ValueType
{
Percent,
ValueRange
};
public:
RoundProgressBar(QWidget *parent = nullptr);
void start();
void stop();
void setValueType(ValueType type);
void setInterval(int interval);
void setRange(int min, int max);
void setValue(int v);
void setFontColor(const QColor &color);
void setInColor(const QColor &color);
void setOutColor(const QColor &color);
protected:
virtual void paintEvent(QPaintEvent *event) override;
private:
void drawValue();
void drawBound();
void drawStartDot();
private:
void _setValue(int v);
int _getValue();
private slots:
void refresh();
private:
QTimer *_t;
QColor _fontColor;
QColor _outColor;
QColor _inColor;
int _interval;
int _value;
int _minValue;
int _maxValue;
ValueType _valueType;
};
#endif // ROUNDPROGRESSBAR_H