16,211
社区成员
发帖
与我相关
我的任务
分享
connect(timer,SIGNAL(timeout()),this,SLOT(slot_setLineEditText());
slot_setLineEditText()
{
ui->lineEdit_3->setText(QString(song.at(textIndex)));
++textIndex;
if(textIndex == song.count())
{
textIndex = 0;
}
}
[/quote]
这样是可以,但是一直在循环,我需要在这个字符最后一个出来的时候就停止,也就是定时器停止,用了下面的代码
if(textIndex == song.count())
{
timer->stop();
}
出现运行错误,然后就自己停止运行了?这是为什么啊!
connect(timer,SIGNAL(timeout()),this,SLOT(slot_setLineEditText());
slot_setLineEditText()
{
ui->lineEdit_3->setText(QString(song.at(textIndex)));
++textIndex;
if(textIndex == song.count())
{
textIndex = 0;
}
}