如下代码所示,想要一个进度条缓慢并且流畅增加的效果,但是运行以后发现进度条增长时有卡顿的情况,于是我增加了定时器的间隔时长,可仍然还是卡顿,各位有解决的办法吗?
QTimer * testTimer = new QTimer(this);
QTimer * timerHP = new QTimer(this);
connect(testTimer,&QTimer::timeout,[=](){
timerHP->start(100);
testTimer->stop();
});
connect(timerHP,&QTimer::timeout,[=](){
player->m_HP += 10;
qDebug()<<player->m_HP;
playGameUi->HP_Bar->setValue(player->m_HP);
if(player->m_HP == 1000)
{
timerHP->stop();
}
});
testTimer->start(2000);