风泥

导航

使用while阻塞程序

使用while阻塞程序,但不使程序卡死

void BlockProgram(int mesc)
{
    //mesc为阻塞时间
    QElapsedTimer timer;
    timer.start();
    while (timer.elapsed() < mesc)
    {
        QCoreApplication::processEvents();
    }   
}

posted on 2016-02-29 18:23  风泥  阅读(212)  评论(0)    收藏  举报