QKeyEvent Class Reference


The QKeyEvent class contains parameters that describe a key event. (details) (complete member list)

#include <qevent.h>

Inherits QEvent.

Public Members


Detailed Description

The QKeyEvent class contains parameters that describe a key event.

Key events contain a special accept flag which tells whether the receiver wants the key.

The virtual functions QWidget::keyPressEvent() and QWidget::keyReleaseEvent() receive key events.


Member Function Documentation

QKeyEvent::QKeyEvent (int type, int key, char ascii, int state)

Constructs a key event object.

The type parameter must be Event_KeyPress or Event_KeyRelease.

The accept flag is set to TRUE.

void QKeyEvent::accept ()

Sets the accept flag of the key event object.

Setting the accept parameter indicates that the receiver of the event wants the key event. Unwanted key events are sent to the parent widget.

The accept flag is set by default.

See also: ignore().

char QKeyEvent::ascii () const

Returns the ASCII code of the key that was pressed or released.

void QKeyEvent::ignore ()

Clears the accept flag parameter of the key event object.

Clearing the accept parameter indicates that the event receiver does not want the key event. Unwanted key events are sent to the parent widget.

The accept flag is set by default.

See also: accept().

bool QKeyEvent::isAccepted () const

Returns TRUE if the receiver of the event wants to keep the key.

int QKeyEvent::key () const

Returns the code if the key that was pressed or released.

The header file qkeycode.h lists the possible keybord codes. These codes are independent of the underlying window system.

int QKeyEvent::state () const

Returns the keyboard modifier flags.

The returned value is ShiftButton, ControlButton and AltButton OR'ed together.


This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.

It was generated from the following files:


Generated at 04:27, 1995/05/20 by the webmaster at Troll Tech