void Widget::Init(){
num=0;
connect(ui->a,SIGNAL(clicked(bool)),this,SLOT(on_a_clicked()));//开始读条
connect(ui->b,SIGNAL(clicked(bool)),this,SLOT(on_b_clicked()));//停止读条
mytime=new QTimer(this);
connect(mytime,SIGNAL(timeout()),this,SLOT(on_tomer()));//定时器
}
void Widget::on_a_clicked()
{
qDebug()<<"a"<<endl;
mytime->start(100);//开始及时间刻度
}
void Widget::on_b_clicked()
{
qDebug()<<"b"<<endl;
mytime->stop();//停止
}
void Widget::on_tomer()
{
num++;
ui->ss->setValue(num);
}