QVirtualKeyboardInputEngine Class

InputEngine class provides an input engine that supports C++ and QML integration. 更多...

头: #include <QVirtualKeyboardInputEngine>
qmake: QT += virtualkeyboard
实例化: InputEngine
继承: QObject

公共类型

enum class InputMode { Latin, Numeric, Dialable, Pinyin, Cangjie, …, Thai }
enum class PatternRecognitionMode { None, PatternRecognitionDisabled, Handwriting, HandwritingRecoginition }
enum class ReselectFlag { WordBeforeCursor, WordAfterCursor, WordAtCursor }
flags ReselectFlags
enum class TextCase { Lower, Upper }

特性

公共函数

Qt::Key activeKey () const
QVirtualKeyboardInputContext * inputContext () const
QVirtualKeyboardAbstractInputMethod * inputMethod () const
QVirtualKeyboardInputEngine::InputMode inputMode () const
QList<int> inputModes () const
QList<int> patternRecognitionModes () const
Qt::Key previousKey () const
bool reselect (int cursorPosition , const QVirtualKeyboardInputEngine::ReselectFlags & reselectFlags )
void setInputMethod (QVirtualKeyboardAbstractInputMethod * inputMethod )
void setInputMode (QVirtualKeyboardInputEngine::InputMode inputMode )
QVirtualKeyboardTrace * traceBegin (int traceId , QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode , const QVariantMap & traceCaptureDeviceInfo , const QVariantMap & traceScreenInfo )
bool traceEnd (QVirtualKeyboardTrace * trace )
void virtualKeyCancel ()
bool virtualKeyClick (Qt::Key key , const QString & text , Qt::KeyboardModifiers modifiers )
bool virtualKeyPress (Qt::Key key , const QString & text , Qt::KeyboardModifiers modifiers , bool repeat )
bool virtualKeyRelease (Qt::Key key , const QString & text , Qt::KeyboardModifiers modifiers )
QVirtualKeyboardSelectionListModel * wordCandidateListModel () const
bool wordCandidateListVisibleHint () const

信号

void activeKeyChanged (Qt::Key key )
void inputMethodChanged ()
void inputMethodReset ()
void inputMethodUpdate ()
void inputModeChanged ()
void inputModesChanged ()
void patternRecognitionModesChanged ()
void previousKeyChanged (Qt::Key key )
void virtualKeyClicked (Qt::Key key , const QString & text , Qt::KeyboardModifiers modifiers , bool isAutoRepeat )
void wordCandidateListModelChanged ()
void wordCandidateListVisibleHintChanged ()

详细描述

The input engine is responsible for routing input events to input methods. The actual input logic is implemented by the input methods.

The input engine also includes the default input method, which takes care of default processing if the active input method does not handle the event.

成员类型文档编制

enum class QVirtualKeyboardInputEngine:: InputMode

This enum specifies the input mode for the input method.

常量 描述
QVirtualKeyboardInputEngine::InputMode::Latin 0 The default input mode for latin text.
QVirtualKeyboardInputEngine::InputMode::Numeric 1 Only numeric input is allowed.
QVirtualKeyboardInputEngine::InputMode::Dialable 2 Only dialable input is allowed.
QVirtualKeyboardInputEngine::InputMode::Pinyin 3 Pinyin input mode for Chinese.
QVirtualKeyboardInputEngine::InputMode::Cangjie 4 Cangjie input mode for Chinese.
QVirtualKeyboardInputEngine::InputMode::Zhuyin 5 Zhuyin input mode for Chinese.
QVirtualKeyboardInputEngine::InputMode::Hangul 6 Hangul input mode for Korean.
QVirtualKeyboardInputEngine::InputMode::Hiragana 7 Hiragana input mode for Japanese.
QVirtualKeyboardInputEngine::InputMode::Katakana 8 Katakana input mode for Japanese.
QVirtualKeyboardInputEngine::InputMode::FullwidthLatin 9 Fullwidth latin input mode for East Asian languages.
QVirtualKeyboardInputEngine::InputMode::Greek 10 Greek input mode.
QVirtualKeyboardInputEngine::InputMode::Cyrillic 11 Cyrillic input mode.
QVirtualKeyboardInputEngine::InputMode::Arabic 12 Arabic input mode.
QVirtualKeyboardInputEngine::InputMode::Hebrew 13 Hebrew input mode.
QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting 14 Chinese handwriting input mode.
QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting 15 Japanese handwriting input mode.
QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting 16 Korean handwriting input mode.
QVirtualKeyboardInputEngine::InputMode::Thai 17 Thai input mode.

enum class QVirtualKeyboardInputEngine:: PatternRecognitionMode

This enum specifies the input mode for the input method.

常量 描述
QVirtualKeyboardInputEngine::PatternRecognitionMode::None 0 Pattern recognition is not available.
QVirtualKeyboardInputEngine::PatternRecognitionMode::PatternRecognitionDisabled None obsolete Use PatternRecognitionMode::None
QVirtualKeyboardInputEngine::PatternRecognitionMode::Handwriting 1 Pattern recognition mode for handwriting recognition.
QVirtualKeyboardInputEngine::PatternRecognitionMode::HandwritingRecoginition Handwriting obsolete Use PatternRecognitionMode::Handwriting

enum class QVirtualKeyboardInputEngine:: ReselectFlag
flags QVirtualKeyboardInputEngine:: ReselectFlags

This enum specifies the rules for word reselection.

常量 描述
QVirtualKeyboardInputEngine::ReselectFlag::WordBeforeCursor 0x1 Activate the word before the cursor. When this flag is used exclusively, the word must end exactly at the cursor.
QVirtualKeyboardInputEngine::ReselectFlag::WordAfterCursor 0x2 Activate the word after the cursor. When this flag is used exclusively, the word must start exactly at the cursor.
QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor WordBeforeCursor | WordAfterCursor 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 ReselectFlags type is a typedef for QFlags <ReselectFlag>. It stores an OR combination of ReselectFlag values.

enum class QVirtualKeyboardInputEngine:: TextCase

This enum specifies the text case for the input method.

常量 描述
QVirtualKeyboardInputEngine::TextCase::Lower 0 Lower case text.
QVirtualKeyboardInputEngine::TextCase::Upper 1 Upper case text.

特性文档编制

activeKey : const Qt::Key

This property holds the active key.

Currently pressed key.

访问函数:

Qt::Key activeKey () const

通知程序信号:

void activeKeyChanged (Qt::Key key )

inputMethod : QVirtualKeyboardAbstractInputMethod *

This property holds the active input method.

Use this property to set active the input method, or to monitor when the active input method changes.

访问函数:

QVirtualKeyboardAbstractInputMethod * inputMethod () const
void setInputMethod (QVirtualKeyboardAbstractInputMethod * inputMethod )

通知程序信号:

void inputMethodChanged ()

inputMode : InputMode

This property holds the current input mode.

Use this property to get or set the current input mode. The InputEngine::inputModes provides list of valid input modes for current input method and locale.

访问函数:

QVirtualKeyboardInputEngine::InputMode inputMode () const
void setInputMode (QVirtualKeyboardInputEngine::InputMode inputMode )

通知程序信号:

void inputModeChanged ()

inputModes : const QList < int >

This property holds the available input modes for active input method.

The list of available input modes is dependent on the input method and locale. This property is updated when either of the dependencies changes.

访问函数:

QList<int> inputModes () const

通知程序信号:

void inputModesChanged ()

patternRecognitionModes : const QList < int >

This property holds the list of available pattern recognition modes.

The list of available pattern recognition modes.

This property was introduced in QtQuick.VirtualKeyboard 2.0.

访问函数:

QList<int> patternRecognitionModes () const

通知程序信号:

void patternRecognitionModesChanged ()

previousKey : const Qt::Key

This property holds the previous active key.

Previously pressed key.

访问函数:

Qt::Key previousKey () const

通知程序信号:

void previousKeyChanged (Qt::Key key )

wordCandidateListModel : QVirtualKeyboardSelectionListModel * const

list model for the word candidate list.

Use this property to access the list model for the word candidate list.

访问函数:

QVirtualKeyboardSelectionListModel * wordCandidateListModel () const

通知程序信号:

void wordCandidateListModelChanged ()

wordCandidateListVisibleHint : const bool

visible hint for the word candidate list.

Use this property to check if the word candidate list should be visible in the UI.

访问函数:

bool wordCandidateListVisibleHint () const

通知程序信号:

void wordCandidateListVisibleHintChanged ()

成员函数文档编制

[signal] void QVirtualKeyboardInputEngine:: activeKeyChanged ( Qt::Key key )

Indicates that the active key 已改变。

注意: 通知程序信号对于特性 activeKey .

[signal] void QVirtualKeyboardInputEngine:: inputMethodChanged ()

Indicates that the input method has changed.

注意: 通知程序信号对于特性 inputMethod .

[signal] void QVirtualKeyboardInputEngine:: inputMethodReset ()

Emitted when the input method needs to be reset.

注意: This signal is automatically connected to QVirtualKeyboardAbstractInputMethod::reset () 和 InputMethod::reset () when the input method is activated.

[signal] void QVirtualKeyboardInputEngine:: inputMethodUpdate ()

注意: This signal is automatically connected to QVirtualKeyboardAbstractInputMethod::update () 和 InputMethod::update () when the input method is activated.

[signal] void QVirtualKeyboardInputEngine:: inputModeChanged ()

Indicates that the input mode has changed.

注意: 通知程序信号对于特性 inputMode .

[signal] void QVirtualKeyboardInputEngine:: inputModesChanged ()

Indicates that the available input modes have changed.

注意: 通知程序信号对于特性 inputModes .

[signal] void QVirtualKeyboardInputEngine:: patternRecognitionModesChanged ()

Indicates that the available pattern recognition modes have changed.

注意: 通知程序信号对于特性 patternRecognitionModes .

This function was introduced in QtQuick.VirtualKeyboard 2.0.

[signal] void QVirtualKeyboardInputEngine:: previousKeyChanged ( Qt::Key key )

Indicates that the previous key 已改变。

注意: 通知程序信号对于特性 previousKey .

[signal] void QVirtualKeyboardInputEngine:: virtualKeyClicked ( Qt::Key key , const QString & text , Qt::KeyboardModifiers modifiers , bool isAutoRepeat )

Indicates that the virtual key was clicked with the given text and modifiers isAutoRepeat indicates if the event is automatically repeated while the key is being pressed. This signal is emitted after the input method has processed the key event.

Qt::Key QVirtualKeyboardInputEngine:: activeKey () const

Returns the currently active key, or Qt::Key_unknown if no key is active.

注意: Getter function for property activeKey.

QVirtualKeyboardInputContext *QVirtualKeyboardInputEngine:: inputContext () const

返回 InputContext instance associated with the input engine.

QVirtualKeyboardAbstractInputMethod *QVirtualKeyboardInputEngine:: inputMethod () const

Returns the active input method.

注意: Getter function for property inputMethod.

另请参阅 setInputMethod ().

QList < int > QVirtualKeyboardInputEngine:: inputModes () const

Returns the list of available input modes.

注意: Getter function for property inputModes.

QList < int > QVirtualKeyboardInputEngine:: patternRecognitionModes () const

Returns list of supported pattern recognition modes.

注意: Getter function for property patternRecognitionModes.

Qt::Key QVirtualKeyboardInputEngine:: previousKey () const

Returns the previously active key, or Qt::Key_unknown if no key has been active.

注意: Getter function for property previousKey.

bool QVirtualKeyboardInputEngine:: reselect ( int cursorPosition , const QVirtualKeyboardInputEngine::ReselectFlags & reselectFlags )

This function attempts to reselect a word located at the cursorPosition reselectFlags define the rules for how the word should be selected in relation to the cursor position.

函数返回 true if the word was successfully reselected.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

This function was introduced in QtQuick.VirtualKeyboard 2.0.

void QVirtualKeyboardInputEngine:: setInputMethod ( QVirtualKeyboardAbstractInputMethod * inputMethod )

设置 inputMethod as the active input method.

注意: Setter 函数对于特性 inputMethod .

另请参阅 inputMethod ().

QVirtualKeyboardTrace *QVirtualKeyboardInputEngine:: traceBegin ( int traceId , QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode , const QVariantMap & traceCaptureDeviceInfo , const QVariantMap & traceScreenInfo )

Starts a trace interaction with the input engine.

The trace is uniquely identified by the traceId . The input engine will assign the id to the QVirtualKeyboardTrace object if the input method accepts the event.

patternRecognitionMode specifies the recognition mode used for the pattern.

If the current input method accepts the event it returns a QVirtualKeyboardTrace object associated with this interaction. If the input method discards the event, it returns a NULL value.

traceCaptureDeviceInfo provides information about the source device and the traceScreenInfo provides information about the screen context.

By definition, the QVirtualKeyboardTrace object remains valid until the traceEnd () method is called.

The trace interaction is ended by calling the traceEnd () 方法。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

This function was introduced in QtQuick.VirtualKeyboard 2.0.

bool QVirtualKeyboardInputEngine:: traceEnd ( QVirtualKeyboardTrace * trace )

Ends the trace interaction with the input engine.

trace object may be discarded at any point after calling this function.

The function returns true if the trace interaction was accepted (i.e. the touch events should not be used for anything else).

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

void QVirtualKeyboardInputEngine:: virtualKeyCancel ()

Reverts the active key state without emitting the key event. This method is useful when the user discards the current key and the key state needs to be restored.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

bool QVirtualKeyboardInputEngine:: virtualKeyClick ( Qt::Key key , const QString & text , Qt::KeyboardModifiers modifiers )

Emits a key click event for the given key , text and modifiers 。返回 true if the key event was accepted by the input engine.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

bool QVirtualKeyboardInputEngine:: virtualKeyPress ( Qt::Key key , const QString & text , Qt::KeyboardModifiers modifiers , bool repeat )

Called by the keyboard layer to indicate that key was pressed, with the given text and modifiers .

key is set as an active key (down key). The actual key event is triggered when the key is released by the virtualKeyRelease () method. The key press event can be discarded by calling virtualKeyCancel ().

The key press also initiates the key repeat timer if repeat is true .

返回 true if the key was accepted by this input engine.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 virtualKeyCancel () 和 virtualKeyRelease ().

bool QVirtualKeyboardInputEngine:: virtualKeyRelease ( Qt::Key key , const QString & text , Qt::KeyboardModifiers modifiers )

Releases the key at key . The method emits a key event for the input method if the event has not been generated by a repeating timer. The text and modifiers are passed to the input method.

返回 true if the key was accepted by the input engine.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .