嗨Qt大师..
我想让我的标签(像素图)关闭关闭关闭很快,我该怎么做?
我尝试使用此代码:
Sleeper::sleep(2);
ui->label->setPixmap(QPixmap("C:/Users/EVAN/Pictures/New folder/85.png"));
Sleeper::sleep(2);
ui->label->setPixmap(QPixmap("C:/Users/EVAN/Pictures/New folder/87.png"));
Sleeper::sleep(2);
ui->label->setPixmap(QPixmap("C:/Users/EVAN/Pictures/New folder/85.png"));
Sleeper::sleep(2);
ui->label->setPixmap(QPixmap("C:/Users/EVAN/Pictures/New folder/87.png"));
那不是工作吗?我该如何解决?谢谢大家
这就是问题 :
if(I==4)
{
QTimer *timer1 = new QTimer(this);
connect(timer1, SIGNAL(timeout()), this, SLOT(OnTimer()));
timer1->start(1000);
blink=true;
port->write(send);
}
else if(I==5)
{
ui->label->setPixmap(QPixmap("../../picture/green.png"));
port->write(send);
}
..................................................
void traffic1::OnTimer()
{
ui->label->setPixmap(QPixmap(blink ? "../../picture/dark.png" : "../../picture/yellow.png"));
blink = !blink;
}
当 I=4 时,Qtimer 正常运行,但当 I=5 时,Qtimer 仍然有效。