W3cubDocs

/Qt 5.15

InputMethod QML Type

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

Import Statement: import QtQuick.VirtualKeyboard 2.15

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.

Note: The corresponding handler is 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.

Note: The corresponding handler is 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.

Note: The corresponding handler is onSelectionListsChanged.

This signal was introduced in QtQuick.VirtualKeyboard 2.2.

Method Documentation

bool clickPreeditText(int cursorPosition)

Called when the user clicks on pre-edit text at cursorPosition.

The function should return true if it handles the event. Otherwise the input falls back to 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 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 further 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 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 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 input engine when the input method is being activated and every time the input method hints are updated. The input method can reserve selection lists by returning the desired selection list types.

The input method may request the input engine to update the selection lists at any time by emitting 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)

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 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. Returns true on success.

See the Trace API for Input Methods how to access the gathered data.

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.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.15/qml-qtquick-virtualkeyboard-inputmethod.html