InputMethod QML Type

Base type for creating input method in QML. 更多...

import 语句: import QtQuick.VirtualKeyboard 2.15

特性

信号

方法

详细描述

The InputMethod type lets you create a custom input method which can be assigned to InputEngine .

特性文档编制

inputContext : InputContext

The input context.

inputEngine : InputEngine

The input engine.

信号文档编制

selectionListActiveItemChanged ( int type , int index )

输入法会发射此信号当当前 index 已改变在选定列表标识通过 type .

注意: 相应处理程序是 onSelectionListActiveItemChanged .

selectionListChanged ( int type )

The input method emits this signal when the contents of the selection list are changed. The type parameter specifies which selection list has changed.

注意: 相应处理程序是 onSelectionListChanged .

selectionListsChanged ()

The input method emits this signal when the selection list types have changed. This signal will trigger a call to selectionLists() method, allowing the input method to update the selection list types.

注意: 相应处理程序是 onSelectionListsChanged .

This signal was introduced in QtQuick.VirtualKeyboard 2.2.

方法文档编制

bool clickPreeditText ( int cursorPosition )

调用当用户点击预编辑文本在 cursorPosition .

函数应返回 true 若它处理事件。否则输入会回退到 reselect() for further processing.

This method was introduced in QtQuick.VirtualKeyboard 2.4.

list < int > inputModes ( string locale )

Returns a list of input modes for locale .

bool keyEvent ( int key , string text , int modifiers )

此方法的目的是, 处理由输入引擎生成的键事件。

The key parameter specifies the code of the key to handle. The key code does not distinguish between capital and non-capital letters. The text parameter contains the Unicode text for the key. The modifiers parameter contains the key modifiers that apply to key .

此方法返回 true if the key event was successfully handled. If the return value is false , the key event is redirected to the default input method for further processing.

list < int > patternRecognitionModes ()

返回支持模式识别方式的列表。

This method is invoked by the input engine to query the list of supported pattern recognition modes.

This method was introduced in QtQuick.VirtualKeyboard 2.0.

bool reselect ( int cursorPosition , int reselectFlags )

This method attempts to reselect a word located at the cursorPosition reselectFlags 定义应如何选择光标位置相关单词的规则。

  • InputEngine.WordBeforeCursor Activate the word before the cursor. When this flag is used exclusively, the word must end exactly at the cursor.
  • InputEngine.WordAfterCursor Activate the word after the cursor. When this flag is used exclusively, the word must start exactly at the cursor.
  • InputEngine.WordAtCursor Activate the word at the cursor. This flag is a combination of the above flags with the exception that the word cannot start or stop at the cursor.

方法返回 true 若单词被成功重选。

This method was introduced in QtQuick.VirtualKeyboard 2.0.

reset ()

This method is called by the input engine when this input method needs to be reset. The input method must reset its internal state only. The main difference to the update() method is that reset() modifies only the input method state; it must not modify the input context.

var selectionListData ( int type , int index , int role )

Returns item data for a selection list identified by type role 参数指定请求何种数据。 index parameter is a zero based index into the selecteion list.

int selectionListItemCount ( int type )

返回选定列表项数标识通过 type .

void selectionListItemSelected ( int type , int index )

此方法被调用当项位于 index 被用户选中。选定列表的标识是通过 type 参数。

list < int > selectionLists ()

Returns the list of selection types used for this input method.

此方法由输入引擎调用,当输入法被激活且每次更新输入法提示时。输入法可以预留选定列表,通过返回期望的选定列表类型。

输入法可以请求输入引擎随时更新选定列表通过发射 selectionListsChanged() signal. This signal will trigger a call to this method, allowing the input method to update the selection list types.

bool setInputMode ( string locale , int inputMode )

变化 inputMode and locale 为此输入法。方法返回 true 若成功。

bool setTextCase ( int textCase )

Updates textCase 为此输入法。方法返回 true 若成功。

The possible values for the text case are:

  • InputEngine.Lower 小写文本。
  • InputEngine.Upper 大写文本。

Trace traceBegin ( int traceId , int patternRecognitionMode , var traceCaptureDeviceInfo , var traceScreenInfo )

此方法被调用当开始跟踪交互采用指定 patternRecognitionMode 。跟踪的唯一标识是通过 traceId traceCaptureDeviceInfo 提供源设备的有关信息和 traceScreenInfo 提供屏幕上下文的有关信息。

If the input method accepts the event and wants to capture the trace input, it must return a new Trace object. This object must remain valid until the InputMethod.traceEnd() method is called. If the Trace is rendered on screen, it remains there until the Trace object is destroyed.

This method was introduced in QtQuick.VirtualKeyboard 2.0.

bool traceEnd ( Trace trace )

此方法被调用,当跟踪交互结束时。输入法应销毁 trace object at some point after this function is called. Returns true 当成功时。

用于输入法的跟踪 API 如何访问聚合数据。

This method was introduced in QtQuick.VirtualKeyboard 2.0.

update ()

This method is called by the input engine when the input method needs to be updated. The input method must close the current pre-edit text and restore the internal state to the default.