Qtopia Home - Classes - Hierachy - Annotated - Functions - Qt Embedded |

# InputMethodInterface Class Reference

The InputMethodInterface class provides an interface for Qtopia Popup Input Methods. More...

`#include <qtopia/inputmethodinterface.h>`

List of all member functions.

## Public Members

- virtual QWidget * inputMethod ( QWidget * parent, Qt::WFlags f ) = 0
- virtual void resetState () = 0
- virtual QPixmap * icon () = 0
- virtual QString name () = 0
- virtual void onKeyPress ( QObject * receiver, const char * slot ) = 0

## Detailed Description

The InputMethodInterface class provides an interface for Qtopia Popup Input Methods.

Popup Input Methods must supply a QWidget that will be shown on the screen and emit a signal when a key is pressed:

Popup Input Methods may be added to Qtopia via plugins. In order to write an input method plugin you must create an interface to your input method by deriving from the InputMethodInterface class and implementing the pure virtual functions.

See also: Input Method Tutorial

## Member Function Documentation

### QPixmap * InputMethodInterface::icon ()`[pure virtual]`

The icon() function returns the icon for the input method. This will be displayed in the taskbar when the input method is selected.

### QWidget * InputMethodInterface::inputMethod ( QWidget * parent, Qt::WFlags f )`[pure virtual]`

The inputMethod() function creates the input method widget (if not already created) and returns the input method widget.

parent is the parent of the input method widget. f contains the flags to pass to the input method widget.

This widget will be display when the user needs to input text. You should always return the same widget if this function is called multiple times.

### QString InputMethodInterface::name ()`[pure virtual]`

The name() function returns the name of the input method. This will be displayed in the popup list of available input methods.

### void InputMethodInterface::onKeyPress ( QObject * receiver, const char * slot )`[pure virtual]`

The onKeyPress() function must connect the supplied slot to the signal that is emitted when a key press is generated.

receiver and slot specify the slot to connect to.

The signal/slot should have a signiture of:

      void keyPress( ushort unicode, ushort keycode, ushort modifiers, bool press, bool repeat )

Parameter | Notes
--- | ---
unicode | The unicode value of the character, or 0xFFFF if it is a non-printing key.
keycode | The key code as specified in `qnamespace.h`
modifiers | A combination of zero or more of the following OR'ed together: Qt::ShiftButton, Qt::ControlButton and Qt::AltButton
press | TRUE for a key press, FALSE for a key release.
repeat | TRUE if this is a repeating keypress.

### void InputMethodInterface::resetState ()`[pure virtual]`

The resetState() function should return the input method to its default state.

This file is part of the Qtopia platform, copyright © 1995-2004 Trolltech, all rights reserved.