[immodule-qt] Does QT 4 beta 1 support IM modules

Daisuke Kameda kaminmat at cc.rim.or.jp
Fri Feb 4 07:28:21 EET 2005


On Friday 04 February 2005 01:53, Lars Knoll wrote:
> I'd like to move the IM switching into Qt itself (I'll try to work on
> implementing this next week). But this would not affect the API.

I also think so.

BTW, I will also consider a simple switching function
which accords with your intention.


> > In the sub class of QMultiInputContext, the function to rebuild
> > QInputMethodEvent may be needed using QInputMethodEvent which slave
> > generated.
[snip]
> > By implementing this function, usefulness of QMultiInputMethod increases.
>
> But to do so, you would need a way to block the event from being delivered
> to the widget from the slave input context. Currently the slave context
> would always directly deliver the event to the widget.

It is right.

Well, I thought other solution. imEventReceived slot is added 
to QInputContext, and QInputContext imEventGenerated signal is 
connected to imEventReceived. Moreover, QInputContext::sendEvent()
emit imEventGenerated signal by default. 

What do you think of this?


QInputContext::QInputContext(QObject* parent)
    : QObject(*new QInputContextPrivate, parent)
{
        QObject::connect( this, SIGNAL(imEventGenerated(QObject 
*,QInputMethodEvent *)),
                          this, SLOT(imEventReceived(QObject 
*,QInputMethodEvent *)) );
}

void QInputContext::imEventReceived(QObject *client, QInputMethodEvent *event)
{
    QInputMethodEvent e(*event);
    qApp->sendEvent(client, &e);
}

void QInputContext::sendEvent(const QInputMethodEvent &event)
{
    QWidget *focus = focusWidget();
    if (!focusWidget())
        return;

    emit imEventGenerated(focus, &event);
}


-- 
Daisuke Kameda <kaminmat at cc.rim.or.jp>



More information about the immodule-qt mailing list