1、使用时间耗损循环;
#include <QTime>
...
QTime delayTime = QTime::currentTime().addMSecs(1000);
while( QTime::currentTime() < delayTime)
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
...
2、QTimer定时;
#include <QTimer> ...
QEventLoop loop; QTimer::singleShot(500, &loop, SLOT(quit()));
...