-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQRoundProgressBar.h
61 lines (50 loc) · 1.77 KB
/
QRoundProgressBar.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
#ifndef QROUNDPROGRESSBAR_H
#define QROUNDPROGRESSBAR_H
#include <QLabel>
#include <QTimer>
#include <QtMath>
#include <QObject>
#include <QPainter>
#include <QWidget>
#include <QPixmap>
#include <QVBoxLayout>
class QRoundProgressBar : public QWidget
{
Q_OBJECT
private:
int startAngle; //起始角度
int endAngle; //结束角度
int ringWidth; //环宽度
int maxRadius; //大圆半径
int iconWidth; //图标的宽度
int currAngle; //当前进度条对应的角度
QRgb circularBorderColor;
QRgb insideMaskColor;
QRgb startGradientColor;
QRgb endGradientColor;
private:
void DrawBarIcon(QPainter&);
void GradientArc(QPainter&,int,QRgb);
void GradientFullArc(QPainter&,QPointF&,int,QRgb);
void DrawOutSideCircle(QPainter&);
void DrawCircularRing(QPainter&,int);
void DrawTwoSmallCircle(QPainter&,int);
void DrawInSideCircle(QPainter&);
void DrawGradientCircle(QPainter&,int);
public:
explicit QRoundProgressBar(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent *event);
public:
//初始化调用函数
void SetStartAngle(int); //设置起始角度值
void SetEndAngle(int); //设置结束角度值
void SetMaxRadius(int); //设置圆环外圆半径
void SetRingWidth(int); //设置圆环宽度
void SetIcomWidth(int); //设置进度图标大小
void SetCircularBorderColor(QRgb); //设置圆环边框颜色
void SetInsideMaskColor(QRgb); //设置内圆遮罩颜色
void SetRadialGradient(QRgb,QRgb); //设置圆环渐变色
void SetCurrPrograss(int); //设置当前进度条进度值
};
#endif