QInputContext

来源:互联网 发布:0基础学通c语言 编辑:程序博客网 时间:2024/06/08 03:07

The QInputContext class abstracts the input method dependent data and composing state.

An input method is responsible for inputting complex text that cannot be inputted via simple keymap. It converts a sequence of input events (typically key events) into a text string through the input method specific converting process. The class of the processes are widely ranging from simple finite state machine to complex text translator that pools a whole paragraph of a text with text editing capability to perform grammar and semantic analysis.

To abstract such different input method specific intermediate information, Qt offers the QInputContext as base class. The concept is well known as 'input context' in the input method domain. An input context is created for a text widget in response to a demand. It is ensured that an input context is prepared for an input method before input to a text widget.

Multiple input contexts that belong to a single input method may concurrently coexist. Suppose multi-window text editor. Each text widget of window A and B holds different QInputContext instance which contains different state information such as partially composed text.

QInputContext用于抽象输入法的相关数据和组成状态

输入法负责输入一些不能使用简单按键布局输入的复杂文本,它将一连串的输入事件(具有代表性的如:按键事件),通过输入法内部具体的转换流程,转换为一条文本字符串。输入法内部的转换流程种类繁多,从简单的状态机到复杂的文本翻译。

为了对不同输入法具体的中间信息进行抽象,Qt提供QinputContext作为基类,该概念在输入法域中通常被称为“输入上下文”。

一个输入上下文会在文本编辑框相应特定需求是创建,以保证每次在编辑一个文本之前,输入法都有一个就绪的输入上下文

一个输入法可能同时存在多个输入上下文,比如多窗口文本编辑器。窗口A和窗口B的文本框使用不同的QInputContex实现,用来存储对应的输入状态信息,比如正文部分



原创粉丝点击