[Interest] QTextLayout::setPreeditArea()

Volker Hilsheimer volker.hilsheimer at qt.io
Tue Jan 4 17:25:41 CET 2022


> On 4 Jan 2022, at 01:33, John Weeks <john at wavemetrics.com> wrote:
>> On Jan 3, 2022, at 2:31 PM, Joshua Grauman <jnfo-d at grauman.com> wrote:
>> 
>> Hi all,
>> 
>> I am working on using QTextLayout and I was wondering if someone could give me a quick explanation for what preedit text / preedit area was in this context? There's not much detail in the docs, reading the Qt code and googling hasn't helped me much.
>> 
>> When/why would you use setPreeditArea(int pos, QString text) vs setText(QString). What's a preedit area?
>> 
>> Thanks in advance,
>> 
>> Josh
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> https://lists.qt-project.org/listinfo/interest
> 
> Maybe something related to an input method? Input methods are used for things like composing Japanese characters.
> 
> -John Weeks
> 


Yes, the preedit-area is the area in which text input widgets display the (preedit) text that is being composed, but not yet committed. E.g. with a Chinese input method, type “chang”; it will be displayed as a preedit text in the preedit area (underlined perhaps, or with a different background color), and the compositor window will open to allow you to pick one of the several glyphs that can be used (for instance, either 长 or 鬯).

So, this is important for complex input methods; but the preedit area is also used for not-so-complex input such as when typing an accented character on some platforms, or for auto completion or auto correction.

Volker




More information about the Interest mailing list