标签:
非阻塞延时:
void GreenPass3::delaymsec(int msec) { QTime dieTime = QTime::currentTime().addMSecs(msec);
while( QTime::currentTime() < dieTime )
QCoreApplication::processEvents(QEventLoop::AllEvents, 100); }
阻塞延时:
void GreenPass3::delaymsec(int msec) {
QTime n=QTime::currentTime();
QTime now; do{ now=QTime::currentTime(); }while (n.msecsTo(now)<=msec);
}
标签:
原文地址:http://www.cnblogs.com/luxiaolai/p/5063402.html