[immodule-qt] Re: Question about deletion of the method of QInputContext

Lars Knoll lars at trolltech.com
Wed Jan 5 19:15:56 EET 2005


On Wednesday 05 January 2005 17:52, Daisuke Kameda wrote:
> I found that some functions were deleted from QInputContext.
> Please teach us the reason about each of the following.
>
>
> 1.  About setFocus() and unsetFocus().
> setFocus() and unsetFocus() were deleted from QInputContext and, naturally
> the corresponding call was also deleted. I think it unnatural and unclear
> to substitute setFocusWidget() and unsetFocusWidget().
> 
> Why did you determine in this way?

Because you do not set focus on an input context. You notify the input context 
about focus changes.

> 2. About setHolderWidget() and holderWidget().
> I think that this lack may lead to unsuitable operation. Actually,
> when XIM is used in style which is not on the spot, preedit will not be
> displayed on a suitable position.

The focus widget is the one you operate on. For over the spot input methods 
you can use the focus widgets position and 
focusWidget()->inputMethodQuery(Qt::ImMicroFocus) to determine the 
information you need to position your input widget.

The holderWidget was only needed in the old code because you had one input 
context per top level.

> 3. About isPreeditPreservationEnabled().
> It seems that you determined to delete it although Yamaken had explained
> several times. Why did you do?

Well, if I understood correctly he said that you need it as long as you have 
one input context per top level and a QInputContext can only hold one low 
level IC (XIC for XIM). The preedit relocation hack moved the preedit string 
from one input widget to the next on focus changes (but only if the two 
widgets had the same toplevel widget). I can't believe this is the behaviour 
you want.

In the current design QInputContext (for XIM, but the same can be implemented 
for other input methods) holds more than one XIC, and can thus deal correctly 
with focus changes. It is now up to the input context if they reset the 
preedit string on focus changes or preserve it. 

So for XIM, focus changes do not any longer cause the preedit string to be 
reset, but it is preserved until the widget regains focus. Please try what I 
have implemented for XIM together with e.g. kinput2 and tell me if this is 
the wanted behaviour.

Best regards,
Lars



More information about the immodule-qt mailing list