QBasicTimer 类

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

详细描述

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 ().

Wiggly example uses QBasicTimer to repaint a widget at regular intervals.

另请参阅 QTimer , QTimerEvent , QObject::timerEvent (), 计时器 ,和 摆动范例 .

成员函数文档编制

QBasicTimer:: QBasicTimer ()

构造基本计时器。

另请参阅 start ().

QBasicTimer:: ~QBasicTimer ()

销毁基本计时器。

bool QBasicTimer:: isActive () const

返回 true if the timer is running and has not been stopped; otherwise returns false .

另请参阅 start () 和 stop ().

void QBasicTimer:: start ( int msec , QObject * object )

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 .

void QBasicTimer:: start ( int msec , Qt::TimerType timerType , QObject * obj )

这是重载函数。

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 .

void QBasicTimer:: stop ()

停止计时器。

另请参阅 start () 和 isActive ().

int QBasicTimer:: timerId () const

返回计时器 ID。

另请参阅 QTimerEvent::timerId ().