This is a very simple example of a pinyin input method.

The input method is defined in pinyinim.h and pinyinim.cpp
The plugin code is in pinyinimpl.h and pinyinimpl.cpp