AbstractInputMethod Class

(QtVirtualKeyboard::AbstractInputMethod)

The base class for input methods. More...

Header: #include <AbstractInputMethod>
Inherits: QObject

Public Functions

AbstractInputMethod(QObject *parent = 0)
~AbstractInputMethod()
InputContext *inputContext() const
InputEngine *inputEngine() const
virtual QList<InputEngine::InputMode> inputModes(const QString &locale) = 0
virtual bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) = 0
virtual QList<InputEngine::PatternRecognitionMode> patternRecognitionModes() const
virtual bool reselect(int cursorPosition, const InputEngine::ReselectFlags &reselectFlags)
virtual QVariant selectionListData(SelectionListModel::Type type, int index, int role)
virtual int selectionListItemCount(SelectionListModel::Type type)
virtual void selectionListItemSelected(SelectionListModel::Type type, int index)
virtual QList<SelectionListModel::Type> selectionLists()
virtual bool setInputMode(const QString &locale, InputEngine::InputMode inputMode) = 0
virtual bool setTextCase(InputEngine::TextCase textCase) = 0
virtual Trace *traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode, const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
virtual bool traceEnd(Trace *trace)
  • 31 public functions inherited from QObject

Public Slots

virtual void reset()
virtual void update()
  • 1 public slot inherited from QObject

Signals

void selectionListActiveItemChanged(int type, int index)
void selectionListChanged(int type)

Protected Functions

AbstractInputMethod(AbstractInputMethodPrivate &dd, QObject *parent = 0)
  • 9 protected functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The base class for input methods.

Use this class if you want to implement a custom input method using C/C++ language.

Member Function Documentation

[protected] AbstractInputMethod::AbstractInputMethod(AbstractInputMethodPrivate &dd, QObject *parent = 0)

Constructs an input method with dd as the private data from the derived class and parent as the parent.

AbstractInputMethod::AbstractInputMethod(QObject *parent = 0)

Constructs an input method with parent.

AbstractInputMethod::~AbstractInputMethod()

Destroys the input method and frees all allocated resources.

InputContext *AbstractInputMethod::inputContext() const

Returns the input context associated with the input method. This method returns NULL if the input method is not active.

InputEngine *AbstractInputMethod::inputEngine() const

Returns the input engine associated with the input method. This method returns NULL if the input method is not active.

[pure virtual] QList<InputEngine::InputMode> AbstractInputMethod::inputModes(const QString &locale)

Returns the list of input modes for locale.

[pure virtual] bool AbstractInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers 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.

[virtual] QList<InputEngine::PatternRecognitionMode> AbstractInputMethod::patternRecognitionModes() const

Returns list of supported pattern recognition modes.

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

This function was introduced in QtQuick.VirtualKeyboard 2.0.

[virtual] bool AbstractInputMethod::reselect(int cursorPosition, const InputEngine::ReselectFlags &reselectFlags)

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

The function returns true if the word was successfully reselected.

This function was introduced in QtQuick.VirtualKeyboard 2.0.

[virtual slot] void AbstractInputMethod::reset()

This method is called by the input engine when the 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, i.e. it must not modify the input context.

[signal] void AbstractInputMethod::selectionListActiveItemChanged(int type, int index)

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

[signal] void AbstractInputMethod::selectionListChanged(int type)

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

[virtual] QVariant AbstractInputMethod::selectionListData(SelectionListModel::Type type, int index, int role)

Returns item data for the selection list identified by type. The role parameter specifies which data is requested. The index parameter is a zero based index into the list.

[virtual] int AbstractInputMethod::selectionListItemCount(SelectionListModel::Type type)

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

[virtual] void AbstractInputMethod::selectionListItemSelected(SelectionListModel::Type 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.

[virtual] QList<SelectionListModel::Type> AbstractInputMethod::selectionLists()

Returns the list of selection lists used by this input method.

This method is called by 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.

[pure virtual] bool AbstractInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)

Sets the inputMode and locale for this input method. Returns true if successful.

[pure virtual] bool AbstractInputMethod::setTextCase(InputEngine::TextCase textCase)

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

[virtual] Trace *AbstractInputMethod::traceBegin(int traceId, InputEngine::PatternRecognitionMode patternRecognitionMode, const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &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 traceEnd() method is called. If the Trace is rendered on screen, it remains there until the Trace object is destroyed.

This function was introduced in QtQuick.VirtualKeyboard 2.0.

[virtual] bool AbstractInputMethod::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.

The method returns true if the trace interaction is accepted.

This function was introduced in QtQuick.VirtualKeyboard 2.0.

[virtual slot] void AbstractInputMethod::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 its internal state to the default.