[提问]qtimer使用stop函数不能终止qtimer调用的槽函数
这是Qtimer start和stop所在的地方,还有一个void timerrenDone()函数,按下走动的人开始按钮,timeren函数执行,然后按下走动的人结束按钮,timerren函数仍然在执行,是我的timer函数用错了,还是timerrenDone()的问题
void Widget::on_pushButton_clicked()//走动的人开始按钮
{
ui->label->show();
ui->label_2->show();
ui->label_3->show();
ui->label_4->show();
ui->label_5->show();
ui->label_6->show();
ui->pushButton->hide();
ui->pushButton_3->show();
QTimer *timerren=new QTimer;
timerren->start(100);
connect(timerren,SIGNAL(timeout()),this,SLOT(timerrenDone()));
ui->pushButton->hide();
}
void Widget::on_pushButton_3_clicked()//走动的人结束按钮
{
timerren->stop();
ui->label->hide();
ui->label_2->hide();
ui->label_3->hide();
ui->label_4->hide();
ui->label_5->hide();
ui->label_6->hide();
ui->pushButton_3->hide();
ui->pushButton->show();
}