在qt中以qelapsed定时器启动计时器,初始时间不为0 [英] start a timer in qelapsed timer in qt with the initial time that is not 0
本文介绍了在qt中以qelapsed定时器启动计时器,初始时间不为0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
喜。我有一个计时器在qelapsed计时器,但我想启动这个计时器的初始时间不是0.例如这个计时器以10秒开始。我怎么做?
谢谢
hi. i have a timer in qelapsed timer but i want to start this timer with initial time that is not 0. for example this timer start with 10 second . how i can do it?
thanks
推荐答案
你可以使用hasExpired()函数只在指定数量的毫秒已过期。
请参阅QT文档了解更多详情:
http://qt-project.org/doc/qt-4.8/qelapsedtimer.html#hasExpired [ ^ ]
在那里您可以找到以下示例:
You can use the hasExpired() function to start your processing only after a specified amount of milliseconds has been expired.
Please refer to the QT documentation for more details:
http://qt-project.org/doc/qt-4.8/qelapsedtimer.html#hasExpired[^]
There you will find the following example:
void executeOperationsForTime(int ms)
{
QElapsedTimer timer;
timer.start();
while (!timer.hasExpired(ms))
slowOperation1();
}
这篇关于在qt中以qelapsed定时器启动计时器,初始时间不为0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文