Qt 延时

#include <QTime>

void MainWindow::sleep(unsigned int msec)
{
    QTime t = QTime::currentTime().addMSecs(msec);

    while(QTime::currentTime() < t)
    {
        QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
    }
}
sleep(500);
posted @ 2018-08-15 20:50  thomas_blog  阅读(114)  评论(0编辑  收藏  举报