qt调用sleep,要包含啥头文件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了qt调用sleep,要包含啥头文件相关的知识,希望对你有一定的参考价值。
实现延时用的
参考技术A 用QSleep函数。包含#include <QTest> //这样就OK了
//代码
QTest::qSleep(250); //250毫秒
以下是QT的官方文档:
void QTest::qSleep(int ms)
Sleeps for ms milliseconds, blocking execution of the test. qSleep() will not do any event processing and leave your test unresponsive. Network communication might time out while sleeping. Use qWait() to do non-blocking sleeping.
ms must be greater than 0.
Note: The qSleep() function calls either nanosleep() on unix or Sleep() on windows, so the accuracy of time spent in qSleep() depends on the operating system.
Example:
QTest::qSleep(250);
See also qWait().本回答被提问者和网友采纳
以上是关于qt调用sleep,要包含啥头文件的主要内容,如果未能解决你的问题,请参考以下文章