QTimerEvent 類

QTimerEvent 類包含計時器事件的描述參數。 更多...

頭: #include <QTimerEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
繼承: QEvent

公共函數

(從 6.8 起) QTimerEvent (Qt::TimerId timerId )
QTimerEvent (int timerId )
(從 6.8 起) Qt::TimerId id () const
(從 6.9 起) bool matches (const QBasicTimer & timer ) const
int timerId () const

詳細描述

計時器事件按定期間隔被發送給已啓動一個或多個計時器的對象。每個計時器擁有唯一標識符。啓動計時器采用 QObject::startTimer ().

The QChronoTimer class provides a high-level programming interface that uses signals instead of events.

事件處理程序 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 of the timer associated with this event, which is the same identifier returned by QObject::startTimer () cast to Qt::TimerId .

該函數在 Qt 6.8 引入。

[noexcept, since 6.9] bool QTimerEvent:: 匹配 (const QBasicTimer & timer ) const

返迴 true if this timer event and timer have the same ID, otherwise returns false .

該函數在 Qt 6.9 引入。

int QTimerEvent:: timerId () const

返迴唯一計時器標識符,其是相同標識符作為返迴來自 QObject::startTimer ().