QPlatformInputContext Class

The QPlatformInputContext class abstracts the input method dependent data and composing state. More...

Header: #include <QPlatformInputContext>
Inherits: QObject

Public Functions

QPlatformInputContext()
virtual ~QPlatformInputContext()
void emitAnimatingChanged()
void emitInputPanelVisibleChanged()
void emitKeyboardRectChanged()
virtual bool filterEvent(const QEvent *event)
virtual bool hasCapability(Capability capability) const
virtual void hideInputPanel()
bool inputMethodAccepted() const
virtual void invokeAction(QInputMethod::Action action, int cursorPosition)
virtual bool isAnimating() const
virtual bool isInputPanelVisible() const
virtual bool isValid() const
virtual QRectF keyboardRect() const
virtual void reset()
virtual void setFocusObject(QObject *object)
virtual void showInputPanel()
virtual void update(Qt::InputMethodQueries)

Static Public Members

QRectF anchorRectangle()
QRectF cursorRectangle()
QRectF inputItemClipRectangle()
QRectF inputItemRectangle()
QRectF keyboardRectangle()
QVariant queryFocusObject(Qt::InputMethodQuery query, QPointF nativePosition)
void setSelectionOnFocusObject(const QPointF &nativeAnchorPos, const QPointF &nativeCursorPos)

Detailed Description

\since5.0 \internal \preliminary \ingroup qpa

An input method is responsible for inputting complex text that cannot be inputted via simple keymap. It converts a sequence of input events (typically key events) into a text string through the input method specific converting process. The class of the processes are widely ranging from simple finite state machine to complex text translator that pools a whole paragraph of a text with text editing capability to perform grammar and semantic analysis.

To abstract such different input method specific intermediate information, Qt offers the QPlatformInputContext as base class. The concept is well known as 'input context' in the input method domain. An input context is created for a text widget in response to a demand. It is ensured that an input context is prepared for an input method before input to a text widget.

QPlatformInputContext provides an interface the actual input methods can derive from by reimplementing methods.

See also QInputMethod.

Member Function Documentation

QPlatformInputContext::QPlatformInputContext()

\internal

[virtual noexcept] QPlatformInputContext::~QPlatformInputContext()

\internal

[static] QRectF QPlatformInputContext::anchorRectangle()

QPlatformInputContext::anchorRectangle

Returns the anchor rectangle for the currently active window and input methiod in native window coordinates.

[static] QRectF QPlatformInputContext::cursorRectangle()

QPlatformInputContext::cursorRectangle

Returns the cursor rectangle for the currently active window and input methiod in native window coordinates.

void QPlatformInputContext::emitAnimatingChanged()

Active QPlatformInputContext is responsible for providing animating property to QInputMethod. In addition of providing the value in isAnimation function, it also needs to call this emit function whenever the property changes.

void QPlatformInputContext::emitInputPanelVisibleChanged()

Active QPlatformInputContext is responsible for providing visible property to QInputMethod. In addition of providing the value in isInputPanelVisible function, it also needs to call this emit function whenever the property changes.

void QPlatformInputContext::emitKeyboardRectChanged()

Active QPlatformInputContext is responsible for providing keyboardRectangle property to QInputMethod. In addition of providing the value in keyboardRect function, it also needs to call this emit function whenever the property changes.

[virtual] bool QPlatformInputContext::filterEvent(const QEvent *event)

This function can be reimplemented to filter input events. Return true if the event has been consumed. Otherwise, the unfiltered event will be forwarded to widgets as ordinary way. Although the input events have accept() and ignore() methods, leave it untouched.

[virtual] bool QPlatformInputContext::hasCapability(Capability capability) const

Returns whether the implementation supports capability. \internal \since 5.4

[virtual] void QPlatformInputContext::hideInputPanel()

Request to hide input panel.

[static] QRectF QPlatformInputContext::inputItemClipRectangle()

QPlatformInputContext::inputItemClipRectangle

Returns the input item clip rectangle for the currently active window and input methiod in native window coordinates.

[static] QRectF QPlatformInputContext::inputItemRectangle()

QPlatformInputContext::inputItemRectangle

Returns the input item rectangle for the currently active window and input methiod in native window coordinates.

bool QPlatformInputContext::inputMethodAccepted() const

Returns true if current focus object supports input method events.

[virtual] void QPlatformInputContext::invokeAction(QInputMethod::Action action, int cursorPosition)

Called when the word currently being composed in the input item is tapped by the user. Input methods often use this information to offer more word suggestions to the user.

[virtual] bool QPlatformInputContext::isAnimating() const

This function can be reimplemented to return true whenever input method is animating shown or hidden. Default implementation returns false.

[virtual] bool QPlatformInputContext::isInputPanelVisible() const

Returns input panel visibility status. Default implementation returns false.

[virtual] bool QPlatformInputContext::isValid() const

Returns input context validity. Deriving implementations should return true.

[virtual] QRectF QPlatformInputContext::keyboardRect() const

This function can be reimplemented to return virtual keyboard rectangle in currently active window coordinates. Default implementation returns invalid rectangle.

[static] QRectF QPlatformInputContext::keyboardRectangle()

QPlatformInputContext::keyboardRectangle

Returns the keyboard rectangle for the currently active window and input methiod in native window coordinates.

[static] QVariant QPlatformInputContext::queryFocusObject(Qt::InputMethodQuery query, QPointF nativePosition)

QPlatformInputContext::queryFocusObject

Queries the current foucus object with a window position in native pixels.

[virtual] void QPlatformInputContext::reset()

Method to be called when input method needs to be reset. Called by QInputMethod::reset(). No further QInputMethodEvents should be sent as response.

[virtual] void QPlatformInputContext::setFocusObject(QObject *object)

This virtual method gets called to notify updated focus to object.

Warning: Input methods must not call this function directly.

[static] void QPlatformInputContext::setSelectionOnFocusObject(const QPointF &nativeAnchorPos, const QPointF &nativeCursorPos)

QPlatformInputContext::setSelectionOnFocusObject anchorPos Beginning of selection in currently active window native coordinates cursorPos End of selection in currently active window native coordinates

[virtual] void QPlatformInputContext::showInputPanel()

Request to show input panel.

[virtual] void QPlatformInputContext::update(Qt::InputMethodQueries)

Notification on editor updates. Called by QInputMethod::update().