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 ().
返迴生成事件的設備類型。
返迴事件發生前立即存在的鍵盤修飾符標誌。
另請參閱 QGuiApplication::keyboardModifiers ().
返迴此事件的窗口係統時間戳。通常以毫秒為單位,從某些任意時間點 (譬如:係統啓動時間) 起。