QInputEvent 類

QInputEvent 類是描述用戶輸入事件的基類。 更多...

頭: #include <QInputEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
繼承: QEvent
繼承者: QContextMenuEvent , QKeyEvent ,和 QPointerEvent

公共函數

const QInputDevice * device () const
QInputDevice::DeviceType deviceType () const
Qt::KeyboardModifiers modifiers () const
quint64 timestamp () const

詳細描述

成員函數文檔編製

[since 6.0] const QInputDevice *QInputEvent:: device () const

Returns the source device that generated the original event.

In case of a synthesized event, for example a mouse event that was generated from a touch event, device() continues to return the touchscreen device, so that you can tell that it did not come from an actual mouse. Thus mouseEvent.source()->type() != QInputDevice::DeviceType::Mouse is one possible replacement for the Qt 5 expression mouseEvent.source() == Qt::MouseEventSynthesizedByQt .

該函數在 Qt 6.0 引入。

另請參閱 QPointerEvent::pointingDevice ().

QInputDevice::DeviceType QInputEvent:: deviceType () const

返迴生成事件的設備類型。

Qt::KeyboardModifiers QInputEvent:: modifiers () const

返迴事件發生前立即存在的鍵盤修飾符標誌。

另請參閱 QGuiApplication::keyboardModifiers ().

quint64 QInputEvent:: timestamp () const

返迴此事件的窗口係統時間戳。通常以毫秒為單位,從某些任意時間點 (譬如:係統啓動時間) 起。