| Classes - Annotated - Tree - Functions - Home - Structure

# QEvent Class Reference

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

`#include <qevent.h>`

Inherits Qt.

Inherited by QChildEvent, QCloseEvent, QCustomEvent, QDragLeaveEvent, QDragResponseEvent, QDropEvent, QFocusEvent, QHideEvent, QKeyEvent, QMouseEvent, QMoveEvent, QPaintEvent, QResizeEvent, QShowEvent, QTimerEvent and QWheelEvent.

List of all member functions.

## Public Members

- enum Type { None = 0, Timer = 1, MouseButtonPress = 2, MouseButtonRelease = 3, MouseButtonDblClick= 4, MouseMove = 5, KeyPress = 6, KeyRelease = 7, FocusIn = 8, FocusOut = 9, Enter = 10, Leave = 11, Paint = 12, Move = 13, Resize = 14, Create = 15, Destroy = 16, Show = 17, Hide = 18, Close = 19, Quit = 20, Reparent = 21, ShowMinimized = 22, ShowNormal = 23, WindowActivate = 24, WindowDeactivate = 25, ShowToParent = 26, HideToParent = 27, ShowMaximized = 28, Accel = 30, Wheel = 31, AccelAvailable = 32, CaptionChange = 33, IconChange = 34, ParentFontChange = 35, ApplicationFontChange = 36, ParentPaletteChange = 37, ApplicationPaletteChange = 38, Clipboard = 40, Speech = 42, SockAct = 50, AccelOverride = 51, DragEnter = 60, DragMove = 61, DragLeave = 62, Drop = 63, DragResponse = 64, ChildInserted = 70, ChildRemoved = 71, LayoutHint = 72, ShowWindowRequest = 73, ActivateControl = 80, DeactivateControl = 81, User = 1000 }
- QEvent ( Type type )
- virtual ~QEvent ()
- Type type () const

## Detailed Description

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

The main event loop of Qt (QApplication::exec()) fetches native window system events from the event queue, translates them into QEvent and sends the translated events to QObjects.

Generally, events come from the underlying window system, but it is also possible to manually send events through the QApplication class using QApplication::sendEvent() and QApplication::postEvent().

QObject received events by having its 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 to another object.

The basic QEvent only contains an event type parameter. Subclasses of QEvent contain additional parameters that describe the particular event.

See also QObject::event(), QObject::installEventFilter(), QWidget::event(), QApplication::sendEvent(), QAppilcation::postEvent() and QApplication::processEvents().

## Member Type Documentation

### QEvent::Type

This enum type defines the valid event types in Qt. The currently defined event types, and the specialized classes for each type, are:

- `None` - not an event
- `Timer` - regular timer events, QTimerEvent
- `MouseButtonPress` - mouse press, QMouseEvent
- `MouseButtonRelease` - mouse release, QMouseEvent
- `MouseButtonDblClick` - mouse press again, QMouseEvent
- `MouseMove` - mouse move, QMouseEvent
- `KeyPress` - key press (including e.g. shift), QKeyEvent
- `KeyRelease` - key release, QKeyEvent
- `FocusIn` - widget gains keyboard focus, QFocusEvent
- `FocusOut` - widget loses keyboard focus, QFocusEvent
- `Enter` - mouse enters widget's space
- `Leave` - mouse leaves widget's soace
- `Paint` - screen update necessary, QPaintEvent
- `Move` - widget's position changed, QMoveEvent
- `Resize` - widget's size changed, QResizeEvent
- `Show` - widget was shown on screen, QShowEvent
- `Hide` - widget was removed from screen, QHideEvent
- `Close` - widget was closed (permanently), QCloseEvent
- `Accel` - key press in child, for shortcut key handling, QKeyEvent
- `Wheel` - mouse wheel rolled, QWheelEvent
- `AccelAvailable` - an internal event used by Qt on some platforms.
- `AccelOverride` - key press in child, for overriding shortcut key handling, QKeyEvent
- `WindowActivate` - the window was activated
- `WindowDeactivate` - the window was deactivated
- `CaptionChange` - widget's caption changed
- `IconChange` - widget's icon changed
- `ParentFontChange` - the font of the parent widget changed.
- `ApplicationFontChange` - the default application font changed.
- `ParentPaletteChange` - the palette of the parent widget changed.
- `ApplicationPaletteChange` - the default application palette changed.
- `Clipboard` - system clipboard contents have changed
- `SockAct` - socket activated, used to implement QSocketNotifier
- `DragEnter` - drag-and-drop enters widget, QDragEnterEvent
- `DragMove` - drag-and-drop in progress, QDragMoveEvent
- `DragLeave` - drag-and-drop leaves widget, QDragLeaveEvent
- `Drop` - drag-and-drop is completed, QDropEvent
- `DragResponse` - an internal event used by Qt on some platforms.
- `ChildInserted` - object gets a child, QChildEvent
- `ChildRemoved` - object loses a child, QChildEvent
- `LayoutHint` - a widget child has changed layout properties
- `ActivateControl` - an internal event used by Qt on some platforms.
- `DeactivateControl` - an internal event used by Qt on some platforms.
- `Quit` - reserved
- `Create` - reserved
- `Destroy` - reserved
- `Reparent` - reserved
- `Configure` - reserved
- `ConfigureLayout` - reserved
- `User` - user defined event

## Member Function Documentation

### QEvent::QEvent ( Type type )

Contructs an event object with a type.

### QEvent::~QEvent () `[virtual]`

Destructs the event. If it was posted, it will be removed from the list of events to be posted.

### QEvent::Type QEvent::type() const

Returns the event type.

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):

This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.