Qt重绘简易时速表
效果:
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/27471099d3cd6e90623723175acfbfba.gif)
使用时,将该类作为QWidget的提升或直接拿来new即可!
classProgress : publicQWidget
{
Q_OBJECT
public:
Progress(QWidget *parent = 0);
~Progress();
protected:
unsignedinttimerId;
voidtimerEvent(QTimerEvent *event);
voidpaintEvent(QPaintEvent *event);
voidinitPainter();
voiddrawY3(QPainter *);
voiddrawOut(QPainter *);
publicslots:
voidsetValue(int);
private:
QPointFcenterPol;
floatradius;
unsignedintvalue,currentValue;
};
Progress::Progress(QWidget *parent) : QWidget(parent)
{
timerId = 0;
value = currentValue = 0;
}
Progress::~Progress()
{
}
voidProgress::timerEvent(QTimerEvent *event)
{
if (event->timerId() == timerId)
{
if (currentValue < value)
{