QTimerEvent Class
QTimerEvent 类包含描述定时器事件的参数。更多
头文件: | #include <QTimerEvent> |
CMake.QTimerEvent | 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 |
详细说明
定时器事件会定期发送给已启动一个或多个定时器的对象。每个定时器都有一个唯一标识符。定时器通过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 。
[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() 返回的标识符相同。
© 2025 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.