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 ().
返回此事件的窗口系统时间戳。通常以毫秒为单位,从某些任意时间点 (譬如:系统启动时间) 起。