|  | Home · Overviews · Examples

# QEvent Class Reference
[com.trolltech.qt.core module]

The `QEvent` class is the base class of all event classes. Event objects contain event parameters. More...

Inherited by `QAccessibleEvent`, `QActionEvent`, `QChildEvent`, `QClipboardEvent`, `QCloseEvent`, `QDragLeaveEvent`, `QDragResponseEvent`, `QDropEvent`, `QDynamicPropertyChangeEvent`, `QFileOpenEvent`, `QFocusEvent`, `QGraphicsSceneEvent`, `QHelpEvent`, `QHideEvent`, `QHoverEvent`, `QIconDragEvent`, `QInputEvent`, `QInputMethodEvent`, `QMoveEvent`, `QPaintEvent`, `QResizeEvent`, `QShortcutEvent`, `QShowEvent`, `QStatusTipEvent`, `QTimerEvent`, `QToolBarChangeEvent`, `QWhatsThisClickedEvent`, and `QWindowStateChangeEvent`.

## Detailed Description

The `QEvent` class is the base class of all event classes. Event objects contain event parameters.

Qt's main event loop (QCoreApplication::exec()) fetches native window system events from the event queue, translates them into QEvents, and sends the translated events to `QObject`s.

In general, events come from the underlying window system (`spontaneous` returns true), but it is also possible to manually send events using QCoreApplication::sendEvent() and QCoreApplication::postEvent() (`spontaneous` returns false).

QObjects receive events by having their QObject::event() function called. The function can be reimplemented in subclasses to customize event handling and add additional event types; QWidget::event() is a notable example. By default, events are dispatched to event handlers like QObject::timerEvent() and QWidget::mouseMoveEvent(). QObject::installEventFilter() allows an object to intercept events destined for another object.

The basic `QEvent` contains only an event type parameter and an "accept" flag. The accept flag set with `accept`, and cleared with `ignore`. It is set by default, but don't rely on this as subclasses may choose to clear it in their constructor.

Subclasses of `QEvent` contain additional parameters that describe the particular event.

See also `QObject::event`, `QObject::installEventFilter`, `QWidget::event`, `QCoreApplication::sendEvent`, `QCoreApplication::postEvent`, and `QCoreApplication::processEvents`.