QT中定时器
目前涉及到的主要有两种:
1、每隔一段时间执行
QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(update())); timer->start(1000); // 1秒
2、单独执行一次
QTimer::singleShot(200, this, SLOT(update())); // 200ms
目前涉及到的主要有两种:
1、每隔一段时间执行
QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(update())); timer->start(1000); // 1秒
QTimer::singleShot(200, this, SLOT(update())); // 200ms