|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QWSKeyboardHandler Class Reference
[QtGui module]

The QWSKeyboardHandler class implements a keyboard driver in Qtopia Core. More...

     #include <QWSKeyboardHandler>

- List of all members, including inherited members

### Public Functions

- QWSKeyboardHandler ()
- virtual ~QWSKeyboardHandler ()
- virtual void processKeyEvent ( int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat )

### Protected Functions

- void beginAutoRepeat ( int unicode, int keycode, Qt::KeyboardModifiers modifier )
- void endAutoRepeat ()
- int transformDirKey ( int keycode )

## Detailed Description

The QWSKeyboardHandler class implements a keyboard driver in Qtopia Core.

A keyboard driver handles events from system devices and generates key events. Custom keyboard drivers can be added by subclassing the QKbdDriverPlugin class, using the QKbdDriverFactory class to dynamically load the driver into the application.

A QWSKeyboardHandler object will usually open some system device, and create a QSocketNotifier object for that device. The QSocketNotifier class provides support for monitoring activity on a file descriptor. When the socket notifier receives data, it will call the keyboard handler's processKeyEvent() function to send the event to the Qtopia Core server application for relaying to clients.

QWSKeyboardHandler also provides functions to control auto-repetion of key sequences, beginAutoRepeat() and endAutoRepeat(), and the transformDirKey() function enabling transformation of arrow keys according to the display orientation.

See also Character Input and Qtopia Core.

## Member Function Documentation

### QWSKeyboardHandler::QWSKeyboardHandler ()

Constructs a keyboard handler.

The handler may be passed to the system for later destruction using the QWSServer::setKeyboardHandler() function, but this is not required (i.e. the handler can still function, calling processKeyEvent() to emit events).

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

Destroys this keyboard handler.

Do not call the destructor if the handler has been passed to the QWSServer::setKeyboardHandler() function.

### void QWSKeyboardHandler::beginAutoRepeat ( int unicode, int keycode, Qt::KeyboardModifiers modifier ) `[protected]`

Begins auto repeating the specified key press: After a short delay the key press is sent periodically until the endAutoRepeat() function is called.

The key press is specified by its unicode, keycode and modifier state.

See also endAutoRepeat() and processKeyEvent().

### void QWSKeyboardHandler::endAutoRepeat () `[protected]`

Stops auto-repeating a key press.

See also beginAutoRepeat() and processKeyEvent().

### void QWSKeyboardHandler::processKeyEvent ( int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat ) `[virtual]`

Sends a key event.

This function is used by QWSKeyboardHandler subclasses to send a key event to the Qtopia Core server application. The server may additionally filter the event before passing it on to client applications.

Parameter | Meaning
--- | ---
unicode | The Unicode value for the key, or 0xFFFF is none is appropriate.
keycode | The Qt keycode for the key (see Qt::Key for the list of codes).
modifiers | The set of modifier keys (see Qt::Modifier).
isPress | Whether this is a press or a release.
autoRepeat | Whether this event was generated by an auto-repeat mechanism, or an actual key press.

See also beginAutoRepeat(), endAutoRepeat(), and transformDirKey().

### int QWSKeyboardHandler::transformDirKey ( int keycode ) `[protected]`

Transforms the arrow key specified by the given keycode, to the orientation of the display and returns the transformed keycode.

The keycode is a Qt::Key value. The values identifying arrow keys are:

- Qt::Key_Left
- Qt::Key_Up
- Qt::Key_Right
- Qt::Key_Down

See also processKeyEvent().