QEvent Class

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QEvent Class Reference

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

`#include <qevent.h>`

Inherits Qt.

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

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, ShowFullScreen = 29, Accel = 30, Wheel = 31, AccelAvailable = 32, CaptionChange = 33, IconChange = 34, ParentFontChange = 35, ApplicationFontChange = 36, ParentPaletteChange = 37, ApplicationPaletteChange = 38, PaletteChange = 39, Clipboard = 40, Speech = 42, SockAct = 50, AccelOverride = 51, DeferredDelete = 52, DragEnter = 60, DragMove = 61, DragLeave = 62, Drop = 63, DragResponse = 64, ChildInserted = 70, ChildRemoved = 71, LayoutHint = 72, ShowWindowRequest = 73, WindowBlocked = 74, WindowUnblocked = 75, ActivateControl = 80, DeactivateControl = 81, ContextMenu = 82, IMStart = 83, IMCompose = 84, IMEnd = 85, Accessibility = 86, TabletMove = 87, LocaleChange = 88, LanguageChange = 89, LayoutDirectionChange = 90, Style = 91, TabletPress = 92, TabletRelease = 93, OkRequest = 94, HelpRequest = 95, WindowStateChange = 96, IconDrag = 97, User = 1000, MaxUser = 65535 }
- QEvent ( Type type )
- virtual ~QEvent ()
- Type type () const
- bool spontaneous () const

## Detailed Description

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

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

In general, events come from the underlying window system (spontaneous() returns TRUE) but it is also possible to manually send events using QApplication::sendEvent() and QApplication::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. Subclasses of QEvent contain additional parameters that describe the particular event.

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

## Member Type Documentation

### QEvent::Type

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

- `QEvent::None` - Not an event.
- `QEvent::Accessibility` - Accessibility information is requested
- `QEvent::Timer` - Regular timer events, QTimerEvent.
- `QEvent::MouseButtonPress` - Mouse press, QMouseEvent.
- `QEvent::MouseButtonRelease` - Mouse release, QMouseEvent.
- `QEvent::MouseButtonDblClick` - Mouse press again, QMouseEvent.
- `QEvent::MouseMove` - Mouse move, QMouseEvent.
- `QEvent::KeyPress` - Key press (including Shift, for example), QKeyEvent.
- `QEvent::KeyRelease` - Key release, QKeyEvent.
- `QEvent::IMStart` - The start of input method composition, QIMEvent.
- `QEvent::IMCompose` - Input method composition is taking place, QIMEvent.
- `QEvent::IMEnd` - The end of input method composition, QIMEvent.
- `QEvent::FocusIn` - Widget gains keyboard focus, QFocusEvent.
- `QEvent::FocusOut` - Widget loses keyboard focus, QFocusEvent.
- `QEvent::Enter` - Mouse enters widget's boundaries.
- `QEvent::Leave` - Mouse leaves widget's boundaries.
- `QEvent::Paint` - Screen update necessary, QPaintEvent.
- `QEvent::Move` - Widget's position changed, QMoveEvent.
- `QEvent::Resize` - Widget's size changed, QResizeEvent.
- `QEvent::Show` - Widget was shown on screen, QShowEvent.
- `QEvent::Hide` - Widget was hidden, QHideEvent.
- `QEvent::ShowToParent` - A child widget has been shown.
- `QEvent::HideToParent` - A child widget has been hidden.
- `QEvent::Close` - Widget was closed (permanently), QCloseEvent.
- `QEvent::ShowNormal` - Widget should be shown normally (obsolete).
- `QEvent::ShowMaximized` - Widget should be shown maximized (obsolete).
- `QEvent::ShowMinimized` - Widget should be shown minimized (obsolete).
- `QEvent::ShowFullScreen` - Widget should be shown full-screen (obsolete).
- `QEvent::ShowWindowRequest` - Widget's window should be shown (obsolete).
- `QEvent::DeferredDelete` - The object will be deleted after it has cleaned up.
- `QEvent::Accel` - Key press in child for shortcut key handling, QKeyEvent.
- `QEvent::Wheel` - Mouse wheel rolled, QWheelEvent.
- `QEvent::ContextMenu` - Context popup menu, QContextMenuEvent
- `QEvent::AccelOverride` - Key press in child, for overriding shortcut key handling, QKeyEvent.
- `QEvent::AccelAvailable` - internal.
- `QEvent::WindowActivate` - Window was activated.
- `QEvent::WindowDeactivate` - Window was deactivated.
- `QEvent::CaptionChange` - Widget's caption changed.
- `QEvent::IconChange` - Widget's icon changed.
- `QEvent::ParentFontChange` - Font of the parent widget changed.
- `QEvent::ApplicationFontChange` - Default application font changed.
- `QEvent::PaletteChange` - Palette of the widget changed.
- `QEvent::ParentPaletteChange` - Palette of the parent widget changed.
- `QEvent::ApplicationPaletteChange` - Default application palette changed.
- `QEvent::Clipboard` - Clipboard contents have changed.
- `QEvent::SockAct` - Socket activated, used to implement QSocketNotifier.
- `QEvent::DragEnter` - A drag-and-drop enters widget, QDragEnterEvent.
- `QEvent::DragMove` - A drag-and-drop is in progress, QDragMoveEvent.
- `QEvent::DragLeave` - A drag-and-drop leaves widget, QDragLeaveEvent.
- `QEvent::Drop` - A drag-and-drop is completed, QDropEvent.
- `QEvent::DragResponse` - Internal event used by Qt on some platforms.
- `QEvent::ChildInserted` - Object gets a child, QChildEvent.
- `QEvent::ChildRemoved` - Object loses a child, QChildEvent.
- `QEvent::LayoutHint` - Widget child has changed layout properties.
- `QEvent::ActivateControl` - Internal event used by Qt on some platforms.
- `QEvent::DeactivateControl` - Internal event used by Qt on some platforms.
- `QEvent::LanguageChange` - The application translation changed, QTranslator
- `QEvent::LayoutDirectionChange` - The direction of layouts changed
- `QEvent::LocaleChange` - The system locale changed
- `QEvent::Quit` - Reserved.
- `QEvent::Create` - Reserved.
- `QEvent::Destroy` - Reserved.
- `QEvent::Reparent` - Reserved.
- `QEvent::Speech` - Reserved for speech input.
- `QEvent::TabletMove` - A Wacom Tablet Move Event.
- `QEvent::Style` - Internal use only
- `QEvent::TabletPress` - A Wacom Tablet Press Event
- `QEvent::TabletRelease` - A Wacom Tablet Release Event
- `QEvent::OkRequest` - Internal event used by Qt on some platforms.
- `QEvent::HelpRequest` - Internal event used by Qt on some platforms.
- `QEvent::IconDrag` - Internal event used by Qt on some platforms when proxy icon is dragged.
- `QEvent::WindowStateChange` - The window's state, i.e. minimized, maximized or full-screen, has changed. See QWidget::windowState().
- `QEvent::WindowBlocked` - The window is modally blocked
- `QEvent::WindowUnblocked` - The window leaves modal blocking
- `QEvent::User` - User defined event.
- `QEvent::MaxUser` - Last user event id.

User events should have values between User and MaxUser inclusive.

## Member Function Documentation

### QEvent::QEvent ( Type type )

Contructs an event object of type type.

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

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

### bool QEvent::spontaneous () const

Returns TRUE if the event originated outside the application, i.e. it is a system event; otherwise returns FALSE.

### Type QEvent::type () const

Returns the event type.

This file is part of the Qt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.