QT中定时器的使用方法
(1)重载timerEvent(QTimerEvent *)函数,然后再在类的构造函数中设置时间间隔
startTimer(50);//单位为毫秒
(2)在类的构造函数中设定如下:
QTimer *timer=new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(timeoutslot()));//timeoutslot()为自定义槽
timer->start(1000);
(1)重载timerEvent(QTimerEvent *)函数,然后再在类的构造函数中设置时间间隔
startTimer(50);//单位为毫秒
(2)在类的构造函数中设定如下:
QTimer *timer=new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(timeoutslot()));//timeoutslot()为自定义槽
timer->start(1000);