Qt 5.11 | Qt Virtual Keyboard | QML Types | InputContext QML Type

Qt Virtual Keyboard | Commercial or GPLv3

# InputContext QML Type

Provides access to an input context. More...

Import Statement: | import QtQuick.VirtualKeyboard 2.3

- List of all members, including inherited members

## Properties

- anchorPosition : int
- anchorRectangle : rect
- animating : bool
- capsLock : bool
- cursorPosition : int
- cursorRectangle : rect
- focus : bool
- inputEngine : InputEngine
- inputItem : QtObject
- inputMethodHints : int
- keyboardRectangle : rect
- locale : string
- preeditText : string
- previewRectangle : rect
- previewVisible : bool
- selectedText : string
- shift : bool
- shiftHandler : ShiftHandler
- surroundingText : string
- uppercase : bool

## Signals

- focusEditorChanged()

## Methods

- void clear()
- void commit(string text, int replaceFrom = 0, int replaceLength = 0)
- void commit()
- void hideInputPanel()
- void sendKeyClick(int key, string text, int modifiers = 0)

## Detailed Description

The InputContext can be accessed as singleton instance.

## Property Documentation

anchorPosition : int

This property is changed when the anchor position changes.

This property was introduced in QtQuick.VirtualKeyboard 2.2.

anchorRectangle : rect

This property is changed when the anchor rectangle changes.

This property was introduced in QtQuick.VirtualKeyboard 2.1.

animating : bool

Use this property to set the animating status, for example during UI transitioning states.

capsLock : bool

This property is changed when the caps lock status changes.

cursorPosition : int

This property is changed when the cursor position changes.

cursorRectangle : rect

This property is changed when the cursor rectangle changes.

focus : bool

This property is changed when the input method receives or loses focus.

inputEngine : InputEngine

This property stores the input engine.

inputItem : QtObject

This property is changed when the focused input item changes.

inputMethodHints : int

This property is changed when the input method hints changes.

keyboardRectangle : rect

Use this property to set the keyboard rectangle.

locale : string

Sets the locale for this input context.

preeditText : string

This property sets the pre-edit text.

previewRectangle : rect

Use this property to set the preview rectangle.

previewVisible : bool

Use this property to set the visibility status of the preview.

selectedText : string

This property is changed when the selected text changes.

shift : bool

This property is changed when the shift status changes.

shiftHandler : ShiftHandler

This property stores the shift handler.

surroundingText : string

This property is changed when the surrounding text around the cursor changes.

uppercase : bool

This property is `true` when either shift or capsLock is `true`.

This property was introduced in QtQuick.VirtualKeyboard 2.2.

## Signal Documentation

focusEditorChanged()

This signal is emitted when the focus editor changes.

## Method Documentation

void clear()

Clears the pre-edit text.

void commit(string text, int replaceFrom = 0, int replaceLength = 0)

Commits the final text to the input item and optionally modifies the text relative to the start of the pre-edit text. If replaceFrom is non-zero, the text replaces the contents relative to replaceFrom with a length of replaceLength.

void commit()

Commits the current pre-edit text.

void hideInputPanel()

This method hides the input panel. This method should only be called when the user initiates the hide, e.g. by pressing a dedicated button on the keyboard.

void sendKeyClick(int key, string text, int modifiers = 0)

Sends a key click event with the given key, text and modifiers to the input item that currently has focus.