- Qt 6.12
- Qt GUI
- C++ Classes
- QInputEvent
- Qt 6.12.0 Reference Documentation

# QInputEvent Class

The QInputEvent class is the base class for events that describe user input. More...

Header: | `#include <QInputEvent>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Gui)` `target_link_libraries(mytarget PRIVATE Qt6::Gui)`
qmake: | `QT += gui`
Inherits: | QEvent
Inherited By: | QContextMenuEvent, QKeyEvent, and QPointerEvent

- List of all members, including inherited members
- QInputEvent is part of Event Classes.

## Public Functions

`(since 6.0)` const QInputDevice * | device() const
QInputDevice::DeviceType | deviceType() const
Qt::KeyboardModifiers | modifiers() const
quint64 | timestamp() const

## Protected Functions

| QInputEvent(QInputEvent &&)
QInputEvent & | operator=(QInputEvent &&)
QInputEvent & | operator=(const QInputEvent &other)

## Detailed Description

## Member Function Documentation

### `[protected delete]` QInputEvent::QInputEvent(QInputEvent &&)

Move-constructs an instance of QInputEvent. This function is deleted.

### `[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`.

This function was introduced in Qt 6.0.

See also QPointerEvent::pointingDevice().

### QInputDevice::DeviceType QInputEvent::deviceType() const

Returns the type of device that generated the event.

### Qt::KeyboardModifiers QInputEvent::modifiers() const

Returns the keyboard modifier flags that existed immediately before the event occurred.

See also QGuiApplication::keyboardModifiers().

### quint64 QInputEvent::timestamp() const

Returns the window system's timestamp for this event. It will normally be in milliseconds since some arbitrary point in time, such as the time when the system was started.

### `[protected delete]` QInputEvent &QInputEvent::operator=(QInputEvent &&)

Move-assigns other to this QInputEvent instance. This function is deleted.

### `[noexcept protected default]` QInputEvent &QInputEvent::operator=(const QInputEvent &other)

Copy-assigns other to this QInputEvent instance.