|  | Home · Overviews · Examples

# QKeyEvent Class Reference
[com.trolltech.qt.gui module]

The `QKeyEvent` class contains describes a key event. More...

Inherits `QInputEvent`.

## Detailed Description

The `QKeyEvent` class contains describes a key event.

Key events are sent to the widget with keyboard input focus when keys are pressed or released.

A key event contains a special accept flag that indicates whether the receiver will handle the key event. You should call `ignore` if the key press or release event is not handled by your widget. A key event is propagated up the parent widget chain until a widget accepts it with `accept` or an event filter consumes it. Key events for multimedia keys are ignored by default. You should call `accept` if your widget handles those events.

The QWidget::setEnable() function can be used to enable or disable mouse and keyboard events for a widget.

The event handlers QWidget::keyPressEvent() and QWidget::keyReleaseEvent() receive key events.

See also `QFocusEvent` and `QWidget::grabKeyboard`.