Qt / KDE and Skim / Xim
LiuCougar
liucougar at gmail.com
Mon May 28 15:20:59 BST 2007
scim-qtimm cvs trunk was ported to qt 4 (it was ported to qt 4.0 or
4.1, I did not test it against latest qt 4.3, but it should be ok)
scim-qtimm trunk is not released yet, so currently you have to
checkout the code from cvs
On 5/28/07, Simon Hausmann <hausmann at kde.org> wrote:
> On Sunday 27 May 2007 21:11:29 Thomas Zander wrote:
> > Hiya,
> >
> > in KOffice I need to port/implement the input method code to allow people
> > to input Chinese or even to input normal composited characters.
> >
> > In my kubuntu kde3 I have a context menu in kmail and in Qts text fields
> > to select the input method. "Select Input Method" with submenu items
> > like "XIM" and "scim".
> >
> > Using this menu is essential to start typing in Chinese, for example.
> >
> > I'm wondering how to do that in KDE in general and in Qt4 when I inherit
> > from QWidget in particular.
>
> The menu is the result of a patch distros ship that adds modular input method
> plugin support to Qt 3. Scim/uim have plugins that Qt loads directly then for
> input method support, instead of going through the ancient xim interface.
>
> In Qt 4 a patch is fortunately not necessary anymore as QInputContext is
> public API and Qt by default loads input context plugins. Unfortunately
> kubuntu at least does not ship any uim/scim plugins for Qt 4 (uim-qt uses
> qt3, despite the package description). So the only way right now to use input
> methods in Kubuntu with Qt 4 is through xim.
>
> So Qt comes with input method "plugins" (they're actually compiled in) for
> Windows and Mac and with one that uses XIM. In addition there is
> src/plugins/inputmethods/imsw-multi which QApplication automatically uses as
> default input context if there is more than one input context plugin
> installed. The imsw-multi input context is a proxy that provides a QAction
> with a sub-menu that allows choosing the current input method. QLineEdit for
> example adds that to the context menu using:
>
> #if !defined(QT_NO_IM)
> QInputContext *qic = inputContext();
> if (qic) {
> QList<QAction *> imActions = qic->actions();
> for (int i = 0; i < imActions.size(); ++i)
> popup->addAction(imActions.at(i));
> }
> #endif
>
> So this is what you may want to do in your custom input widget, too.
>
> However since there is no shipped qt 4 input method plugin at the moment in
> kubuntu at least you can test input method support only through xim
> basically. But that works fine for me:
>
> * Install scim, skim and for example scim-tables-additional
> * Enable the languages in skim
> * set XMODIFIERS to @im=SCIM
> * Start a Qt application
> * Activate the input method using Ctrl+Space
>
> In order to receive input method events and queries (see
> QWidget::inputMethodQuery) you have to set the Qt::WA_InputMethodEnabled
> widget attribute.
>
> Simon
>
>
--
http://www.liucougar.net
生于忧患,死于安乐
"People's characters are strengthened through struggle against
difficulties; they are weakened by comfort."
- Old Chinese adage
More information about the kde-core-devel
mailing list