Home · API Reference · Modules |
This page is a short tutorial about creating your own input method plugin. MeeGo Touch Input Method provides a framework which developers can extend the functionality of the input method by providing a new input method user interface. The new input method is implemented as a plugin.
This page shows some excerpts from MeeGo Keyboard source code.
There are two important parts in the plugin making: the user interface of the input method, which is the part that user interact with while inputting text; and the settings, which is the part that enables user to set preferences on the input method.
The UI is loaded and controlled by a MAbstractInputMethod class.
The MAbstractInputMethod itself needs to be loaded by the plugin class, which is a MInputMethodPlugin class. For the plugin system to work, class must declare proper interface using Q_INTERFACES (in the header file) and export the plugin with Q_EXPORT_PLUGIN2 (in the .cpp file):
The UI class is created in the createInputMethod method:
The plugin is given a main window that should be used as a parent widget for plugin visualization. Plugin is then free to create a QWidget or QGraphicsView or similar.
The interaction between the UI and the application is done by employing functions provided by MAbstractInputMethod and MAbstractInputMethodHost.
Settings is basically a QGraphicsWidget which holds items to provide user to set some preferences or behaviour of the input method. It is displayed in the control panel of the system.
The settings is created by subclassing MAbstractInputMethodSettings.
The actual widget shown is created in MKeyboardSettings::createContentWidget:
To use the framework you need to add plugin
and meegoimframework
to CONFIG
variable in your project file.
The plugin is installed to /usr/lib/meego-im-plugins
directory. Depending on the user interface type, the plugin can be activated programmaticaly by setting the handler GConf key to the name of the plugin. The GConf parent key is /meegotouch/inputmethods/plugins/handler
.
During runtime the plugin can be selected from control panel on the system.
Copyright © 2011 Nokia Corporation | Maliit |