/* 函数名:sleep() 参 数: msec - 单位为毫秒 描 述: 延时功能 */ bool Test::sleep(unsigned int msec) { QTime dieTime = QTime::currentTime().addMSecs(msec); while (QTime::currentTime() < dieTime) { QCoreApplication::processEvents(QEventLoop::AllEvents, 100); } return true; }