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


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:

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-2005 Trolltech. All Rights Reserved.


Copyright © 2005 TrolltechTrademarks
Qt 3.3.6