Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QWSInputMethod Class Reference

The QWSInputMethod class provides international input methods for Qt/Embedded. More...

    #include <QWSInputMethod>

Inherits QObject.

- List of all members, including inherited members

### Writable Properties

- 1 writable property inherited from QObject

### Public Functions

- QWSInputMethod ()
- virtual ~QWSInputMethod ()
- virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ) = 0
- QFont font () const
- QRect inputRect () const
- virtual void mouseHandler ( int x, int state )
- virtual void reset ()
- virtual void setMicroFocus ( int x, int y )

- 26 public functions inherited from QObject

### Public Slots

- 1 public slot inherited from QObject

### Signals

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QObject

### Protected Functions

- void sendIMEvent ( QWSServer::IMState state, const QString & txt, int cpos, int selLen = 0 )

- 7 protected functions inherited from QObject

## Detailed Description

The QWSInputMethod class provides international input methods for Qt/Embedded.

Subclass this class to implement your own input method.

An input methods consists of a keyboard filter and optionally a graphical interface. The keyboard filter intercepts key events from physical or virtual keyboards by implementing the filter() function.

Use sendIMEvent() to send composition events. Composition starts with the input method sending an `InputMethodStart` event, followed by a number of `InputMethodCompose` events and ending with an `InputMethodEnd` event or when the virtual reset() function is called.

The function setMicroFocus() is called when the focus widget changes its cursor position.

The functions font() and inputRect() provide more information about the state of the focus widget.

Use QWSServer::setCurrentInputMethod() to install an input method.

## Member Function Documentation

### QWSInputMethod::QWSInputMethod ()

Constructs a new input method

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

Destructs the input method uninstalling it if it is currently installed.

### bool QWSInputMethod::filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ) `[pure virtual]`

This function must be implemented in subclasses to handle key input from physical or virtual keyboards. Returning true will block the event from further processing.

The Unicode value is given in unicode and the key code in keycode. Keyboard modifiers are OR-ed together in modifiers. If isPress is true this is a key press; otherwise it is a key release. If autoRepeat is true this is an auto-repeated key press.

All normal key events should be blocked while in compose mode (i.e., between `InputMethodStart` and `InputMethodEnd`).

### QFont QWSInputMethod::font () const

Returns the font of the current input widget

### QRect QWSInputMethod::inputRect () const

Returns the input rectangle of the current input widget. The input rectangle covers the width of the input widget, and may extend below it. This can be used to determine the geometry of an input widget for over-the-spot input methods.

### void QWSInputMethod::mouseHandler ( int x, int state ) `[virtual]`

Implemented in subclasses to handle mouse presses/releases within the on-the-spot text. The parameter x is the offset within the string that was sent with the InputMethodCompose event. state is either `QWSServer::MousePress` or `QWSServer::MouseRelease`

### void QWSInputMethod::reset () `[virtual]`

Implemented in subclasses to reset the state of the input method.

### void QWSInputMethod::sendIMEvent ( QWSServer::IMState state, const QString & txt, int cpos, int selLen = 0 ) `[protected]`

Causes a QIMEvent to be sent to the focus widget. state may be one of `QWSServer::InputMethodStart`, `QWSServer::InputMethodCompose` or `QWSServer::InputMethodEnd`.

txt is the text being composed (or the finished text if state is `InputMethodEnd`). cpos is the current cursor position.

If state is `InputMethodCompose`, selLen is the number of characters in the composition string (starting at cpos) that should be marked as selected by the input widget receiving the event.

### void QWSInputMethod::setMicroFocus ( int x, int y ) `[virtual]`

Implemented in subclasses to handle microFocusHint changes in the focus widget. x and y are the global coordinates of the cursor position.