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

[Contents]

# Character Input

When running a Qtopia Core application, it either runs as a server or connects to an existing server. Internally in the client/server protocol, each key press and key release is sent as a QWSKeyEvent object to the server.

A key event can be generated from a keyboard driver. A keyboard driver reads data from a device, finds out which keys were pressed, and then calls the static QWSServer::processKeyEvent() function with the key information. But key events do not always come from a keyboard device, they can can also be generated by the server process.

Input Widgets The server process may call the static QWSServer::sendKeyEvent() function at any time. Typically, this is done by popping up a widget, and letting the user specify characters with the pointer device. Note that the key input widget should not take focus, since the server would then just send the key events back to the input widget. One way to make sure that the input widget never takes focus is to set the Qt::Tool widget flag in the QWidget constructor. The Qtopia environment contains various input widgets such as Handwriting Recognition and Virtual Keyboard.

The various keyboard drivers can be compiled into the library or loaded as plugins, and enabled and disabled using the `configure` script. For example:

     configure -qt-kbd-s15000

Run `./configure -help` to list the available keyboard drivers. In the default Qt configuration, only the "tyy" driver is enabled.

- Available Keyboard Drivers
- Specifying a Keyboard Driver

## Available Keyboard Drivers

Qtopia Core provides drivers for the SL5000, Yopy, Vr41XX, console (TTY) and USB protocols.

Note that the console keyboard driver also handles console switching (Ctrl+Alt+F1, ..., Ctrl+Alt+F10) and termination (Ctrl+Alt+Backspace).

Other drivers can be added by deriving from the QWSKeyboardHandler and QKbdDriverPlugin classes and using Qt's plugin mechanism.

## Specifying a Keyboard Driver

To specify which driver to use, set the QWS_KEYBOARD environment variable. For example (if the current shell is bash, ksh, zsh or sh):

      export QWS_KEYBOARD=<driver>:<device>

The `<driver>` argument is either `SL5000`, `Yopy`, `VR41xx`, `TTY` or `USB`, and the `<device>` argument is typically `/dev/tty0`. Note that the latter argument is optional.

Multiple keyboard drivers can be specified in one go:

      export QWS_KEYBOARD="<driver> <driver> <driver>:<device>"

Input will be read from all of specified drivers.

[Contents]