QBasicTimer 类为对象提供计时器事件。 更多...
头: | #include <QBasicTimer> |
qmake: | QT += core |
QBasicTimer (QBasicTimer && other ) | |
QBasicTimer () | |
QBasicTimer & | operator= (QBasicTimer && other ) |
~QBasicTimer () | |
bool | isActive () const |
void | start (int msec , QObject * object ) |
void | start (int msec , Qt::TimerType timerType , QObject * obj ) |
void | stop () |
void | swap (QBasicTimer & other ) |
int | timerId () const |
这是用于 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
().
Objects of this class cannot be copied, but can be moved, so you can maintain a list of basic timers by holding them in container that supports move-only types, e.g. std::vector.
Wiggly example uses QBasicTimer to repaint a widget at regular intervals.
另请参阅 QTimer , QTimerEvent , QObject::timerEvent (), 计时器 ,和 摆动范例 .
Swaps string other with this string, or lhs with rhs 。此操作非常快且从不失败。
该函数在 Qt 5.14 引入。
Move-constructs a basic timer from other , which is left inactive .
该函数在 Qt 5.14 引入。
构造基本计时器。
另请参阅 start ().
移动赋值 other to this basic timer. The timer previously represented by this basic timer is stopped. other is left as inactive .
该函数在 Qt 5.14 引入。
另请参阅 stop (), isActive (),和 swap ().
销毁基本计时器。
返回
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 ().