QInputMethod Class
The QInputMethod class provides access to the active text input method. More...
| Header: | #include <QInputMethod> |
| qmake: | QT += gui |
| Inherits: | QObject |
Public Types
| enum | Action { Click, ContextMenu } |
Properties
|
|
Public Functions
| QRectF | anchorRectangle() const |
| QRectF | cursorRectangle() const |
| Qt::LayoutDirection | inputDirection() const |
| QRectF | inputItemClipRectangle() const |
| bool | isAnimating() const |
| bool | isVisible() const |
| QRectF | keyboardRectangle() const |
| QLocale | locale() const |
Signals
| void | anchorRectangleChanged() |
| void | animatingChanged() |
| void | cursorRectangleChanged() |
| void | inputDirectionChanged(Qt::LayoutDirection newDirection) |
| void | inputItemClipRectangleChanged() |
| void | keyboardRectangleChanged() |
| void | localeChanged() |
| void | visibleChanged() |
Detailed Description
QInputMethod is used by the text editors for integrating to the platform text input methods and more commonly by application views for querying various text input method-related information like virtual keyboard visibility and keyboard dimensions.
Qt Quick also provides access to QInputMethod in QML through Qt global object as Qt.inputMethod property.
Member Type Documentation
enum QInputMethod::Action
Indicates the kind of action performed by the user.
| Constant | Value | Description |
|---|---|---|
QInputMethod::Click | 0 | A normal click/tap |
QInputMethod::ContextMenu | 1 | A context menu click/tap (e.g. right-button or tap-and-hold) |
See also invokeAction().
Property Documentation
anchorRectangle : const QRectF
Input item's anchor rectangle in window coordinates.
Anchor rectangle is often used by various text editing controls like text prediction popups for following the text selection.
Access functions:
| QRectF | anchorRectangle() const |
Notifier signal:
| void | anchorRectangleChanged() |
animating : const bool
True when the virtual keyboard is being opened or closed.
Animating is false when keyboard is fully open or closed. When animating is true and visibility is true keyboard is being opened. When animating is true and visibility is false keyboard is being closed.
Access functions:
| bool | isAnimating() const |
Notifier signal:
| void | animatingChanged() |
cursorRectangle : const QRectF
Input item's cursor rectangle in window coordinates.
Cursor rectangle is often used by various text editing controls like text prediction popups for following the text being typed.
Access functions:
| QRectF | cursorRectangle() const |
Notifier signal:
| void | cursorRectangleChanged() |
inputDirection : const Qt::LayoutDirection
Current input direction.
Access functions:
| Qt::LayoutDirection | inputDirection() const |
Notifier signal:
| void | inputDirectionChanged(Qt::LayoutDirection newDirection) |
inputItemClipRectangle : const QRectF
Input item's clipped rectangle in window coordinates.
The clipped input rectangle is often used by various input methods to determine how much screen real estate is available for the input method (e.g. Virtual Keyboard).
Access functions:
| QRectF | inputItemClipRectangle() const |
Notifier signal:
| void | inputItemClipRectangleChanged() |
keyboardRectangle : const QRectF
Virtual keyboard's geometry in window coordinates.
This might be an empty rectangle if it is not possible to know the geometry of the keyboard. This is the case for a floating keyboard on android.
Access functions:
| QRectF | keyboardRectangle() const |
Notifier signal:
| void | keyboardRectangleChanged() |
locale : const QLocale
Current input locale.
Access functions:
| QLocale | locale() const |
Notifier signal:
| void | localeChanged() |
visible : const bool
Virtual keyboard's visibility on the screen
Input method visibility remains false for devices with no virtual keyboards.
Access functions:
| bool | isVisible() const |
Notifier signal:
| void | visibleChanged() |
See also show() and hide().