QInputEvent Class

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

Header: #include <QInputEvent>
Inherits: QEvent
Inherited By:

QContextMenuEvent, QKeyEvent, and QPointerEvent

Public Functions

QInputEvent(Type type, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier)
const QInputDevice *device() const
QInputDevice::DeviceType deviceType() const
Qt::KeyboardModifiers modifiers() const
void setModifiers(Qt::KeyboardModifiers modifiers)
virtual void setTimestamp(quint64 atimestamp)
quint64 timestamp() const

Protected Functions

QInputEvent(Type type, PointerEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier)
QInputEvent(Type type, SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier)

Detailed Description

\ingroupevents \inmodule QtGui

Member Function Documentation

[explicit] QInputEvent::QInputEvent(Type type, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier)

\internal

[protected] QInputEvent::QInputEvent(Type type, PointerEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier)

\internal

[protected] QInputEvent::QInputEvent(Type type, SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier)

\internal

const QInputDevice *QInputEvent::device() const

\since6.0

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.

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 setModifiers() and QGuiApplication::keyboardModifiers().

void QInputEvent::setModifiers(Qt::KeyboardModifiers modifiers)

\internal

Sets the keyboard modifiers flags for this event.

See also modifiers().

[virtual] void QInputEvent::setTimestamp(quint64 atimestamp)

\internal

Sets the timestamp for this event.

See also timestamp().

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.

See also setTimestamp().