QTimerEvent Class
QTimerEvent 类包含用于描述定时器事件的参数。更多内容...
| 头文件: | #include <QTimerEvent> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
| 继承自: | QEvent |
- 所有成员列表,包括继承的成员
- QTimerEvent 属于事件类。
公共函数
(since 6.8) | QTimerEvent(Qt::TimerId timerId) |
| QTimerEvent(int timerId) | |
(since 6.8) Qt::TimerId | id() const |
(since 6.9) bool | matches(const QBasicTimer &timer) const |
| int | timerId() const |
受保护函数
| QTimerEvent(QTimerEvent &&) | |
| QTimerEvent & | operator=(QTimerEvent &&) |
| QTimerEvent & | operator=(const QTimerEvent &other) |
详细说明
定时器事件会以固定间隔发送给已启动一个或多个定时器的对象。每个定时器都有一个唯一的标识符。定时器通过QObject::startTimer() 启动。
QChronoTimer 类提供了一个高级编程接口,该接口使用信号代替事件。
事件处理程序QObject::timerEvent() 用于接收定时器事件。
另请参阅 QChronoTimer 、QObject::timerEvent()、QObject::startTimer() 以及QObject::killTimer()。
成员函数文档
[explicit, since 6.8] QTimerEvent::QTimerEvent(Qt::TimerId timerId)
创建一个定时器事件对象,并将定时器标识符设置为timerId 。
该函数于 Qt 6.8 版本中引入。
[explicit] QTimerEvent::QTimerEvent(int timerId)
创建一个定时器事件对象,并将定时器标识符设置为timerId 。
[protected delete] QTimerEvent::QTimerEvent(QTimerEvent &&)
通过移动构造创建一个QTimerEvent 的实例。该函数已被删除。
[since 6.8] Qt::TimerId QTimerEvent::id() const
返回与该事件关联的定时器的Qt::TimerId ,该标识符与QObject::startTimer()返回的标识符相同,但已被强制转换为Qt::TimerId 。
该函数在 Qt 6.8 中引入。
[noexcept, since 6.9] bool QTimerEvent::matches(const QBasicTimer &timer) const
如果该定时器事件与timer 的 ID 相同,则返回true ;否则返回false 。
该函数于 Qt 6.9 中引入。
int QTimerEvent::timerId() const
返回唯一的定时器标识符,该标识符与QObject::startTimer() 返回的标识符相同。
[protected delete] QTimerEvent &QTimerEvent::operator=(QTimerEvent &&)
将other 按移动赋值给此QTimerEvent 实例。该函数已被删除。
[noexcept protected default] QTimerEvent &QTimerEvent::operator=(const QTimerEvent &other)
将other 复制并赋值给该QTimerEvent 实例。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.