QT延时函数sleep

转自:http://blog.sina.com.cn/s/blog_613cfe940100kacm.html

以下这个代码主要是实现以毫秒为单位的延时

void sleep(unsigned int msec)
{
QTime dieTime = QTime::currentTime().addMSecs(msec);
while( QTime::currentTime() < dieTime )
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}

Powered by Zoundry Raven

你可能感兴趣的:(QT延时函数sleep)