The QBasicTimer class provides timer events for objects. 更多...
头: | #include <QBasicTimer> |
qmake: | QT += core |
QBasicTimer () | |
~QBasicTimer () | |
bool | isActive () const |
void | start (int msec , QObject * object ) |
void | start (int msec , Qt::TimerType timerType , QObject * obj ) |
void | stop () |
int | timerId () const |
The QBasicTimer class provides timer events for objects.
这是用于 Qt 内部的快速、轻量、低级类。推荐使用更高级的 QTimer class rather than this class if you want to use timers in your applications. Note that this timer is a repeating timer that will send subsequent timer events unless the stop () 函数被调用。
To use this class, create a
QBasicTimer
, and call its
start
() function with a timeout interval and with a pointer to a
QObject
subclass. When the timer times out it will send a timer event to the
QObject
subclass. The timer can be stopped at any time using
stop
().
isActive
() 返回
true
for a timer that is running; i.e. it has been started, has not reached the timeout time, and has not been stopped. The timer's ID can be retrieved using
timerId
().
The Wiggly example uses QBasicTimer to repaint a widget at regular intervals.
另请参阅 QTimer , QTimerEvent , QObject::timerEvent (), 计时器 ,和 摆动范例 .
构造基本计时器。
另请参阅 start ().
销毁基本计时器。
返回
true
if the timer is running and has not been stopped; otherwise returns
false
.
Starts (or restarts) the timer with a msec milliseconds timeout. The timer will be a Qt::CoarseTimer 。见 Qt::TimerType for information on the different timer types.
给定 object 将接收计时器事件。
另请参阅 stop (), isActive (), QObject::timerEvent (),和 Qt::CoarseTimer .
这是重载函数。
Starts (or restarts) the timer with a msec milliseconds timeout and the given timerType 。见 Qt::TimerType for information on the different timer types.
obj 将接收计时器事件。
另请参阅 stop (), isActive (), QObject::timerEvent (),和 Qt::TimerType .
停止计时器。
返回计时器 ID。
另请参阅 QTimerEvent::timerId ().