QTimer简介

The QTimer class provides repetitive and single-shot timers.
The QTimer class provides a high-level programming interface for timers. To use it, create a QTimer, connect its timeout() signal to the appropriate slots, and call start(). From then on it will emit the timeout() signal at constant intervals.
Example for a one second (1000 millisecond) timer (from the Analog Clock example):

QTimer类提供了重复的和信号槽的记时器。QTimer为记时器提供了一个高级程序接口。创建一个记时器实例,连接它的timeout()信号到适当的槽。然后执行start()函数,从这时开始,它将以一个恒定的间隔发射timeout()信号。
例如:一个一秒(1000豪秒)的记时器(来自于例子模拟时钟)。

 

     QTimer *timer = new QTimer(this);
     connect(timer, SIGNAL(timeout()), this, SLOT(update()));
     timer->start(1000);

 

From then on, the update() slot is called every second.
从那时起,update()函数每隔一秒就会被调用一次。

 

还有些高级的功能,比如在多线程里的QTimer,等需要的时候再翻译。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值