InputMethod QML Type

Base type for creating input method in QML. More...

Import Statement: import QtQuick.VirtualKeyboard 2.0

Properties

Signals

Methods

Detailed Description

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

Property Documentation

inputContext : InputContext

The input context.


inputEngine : InputEngine

The input engine.


Signal Documentation

selectionListActiveItemChanged(int type, int index)

The input method emits this signal when the current index has changed in the selection list identified by type.


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.


Method Documentation

list<int> inputModes(string locale)

Returns a list of input modes for locale.


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

The purpose of this method is to handle the key events generated by the the input engine.

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.

This method returns 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 futher processing.


list<int> patternRecognitionModes()

Returns list of supported pattern recognition modes.

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

This QML 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. The reselectFlags define the rules for how the word should be selected in relation to the cursor position.

  • 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.

The method returns true if the word was successfully reselected.

This QML 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. The role parameter specifies which data is requested. The index parameter is a zero based index into the selecteion list.


int selectionListItemCount(int type)

Returns the number of items in the selection list identified by type.


void selectionListItemSelected(int type, int index)

This method is called when an item at index has been selected by the user. The selection list is identified by the type parameter.


list<int> selectionLists()

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

This method is called by the input engine when the input method is being activated. The input method can reserve the selection lists for its use by returning a list of selection list types required.


bool setInputMode(string locale, int inputMode)

Changes inputMode and locale for this input method. The method returns true if successful.


bool setTextCase(int textCase)

Updates textCase for this input method. The method returns true if successful.

The possible values for the text case are:

  • InputEngine.Lower Lower case text.
  • InputEngine.Upper Upper case text.

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

This method is called when a trace interaction starts with the specified patternRecognitionMode. The trace is uniquely identified by the traceId. The traceCaptureDeviceInfo provides information about the source device and the traceScreenInfo provides information about the screen context.

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 QML method was introduced in QtQuick.VirtualKeyboard 2.0.


bool traceEnd(Trace trace)

This method is called when the trace interaction ends. The input method should destroy the trace object at some point after this function is called. See the Trace API how to access the gathered data.

This QML 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.