PySide6.QtGui.QInputMethod¶
- class QInputMethod¶
- The - QInputMethodclass provides access to the active text input method. More…- Synopsis¶- Properties¶- anchorRectangleᅟ- Input item’s anchor rectangle in window coordinates
- animatingᅟ- True when the virtual keyboard is being opened or closed
- cursorRectangleᅟ- Input item’s cursor rectangle in window coordinates
- inputDirectionᅟ- Current input direction
- inputItemClipRectangleᅟ- Input item’s clipped rectangle in window coordinates
- keyboardRectangleᅟ- Virtual keyboard’s geometry in window coordinates
- localeᅟ- Current input locale
- visibleᅟ- Virtual keyboard’s visibility on the screen
 - Methods¶
- def - inputDirection()
- def - isAnimating()
- def - isVisible()
- def - locale()
- def - setVisible()
 - Slots¶- Signals¶- Static functions¶- Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- QInputMethodis 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 - QInputMethodin QML through Qt global object as- Qt.inputMethodproperty.- class Action¶
- Indicates the kind of action performed by the user. - Constant - Description - QInputMethod.Click - A normal click/tap - QInputMethod.ContextMenu - A context menu click/tap (e.g. right-button or tap-and-hold) - See also 
 - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- This property holds 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:
 - property animatingᅟ: bool¶
 - This property holds True when the virtual keyboard is being opened or closed.. - Animating is false when keyboard is fully open or closed. When - animatingis- trueand- visibilityis- truekeyboard is being opened. When- animatingis- trueand- visibilityis false keyboard is being closed.- Access functions:
- Signal - animatingChanged()
 
 - This property holds 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:
 - property inputDirectionᅟ: Qt.LayoutDirection¶
 - This property holds Current input direction.. - Access functions:
 - This property holds 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:
 - This property holds 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:
 - This property holds Current input locale.. - Access functions:
- Signal - localeChanged()
 
 - property visibleᅟ: bool¶
 - This property holds Virtual keyboard’s visibility on the screen. - Input method visibility remains false for devices with no virtual keyboards. - Access functions:
- Signal - visibleChanged()
 
 - Getter of property - anchorRectangleᅟ.- anchorRectangleChanged()¶
 - Notification signal of property - anchorRectangleᅟ.- animatingChanged()¶
 - Notification signal of property - animatingᅟ.- commit()¶
 - Commits the word user is currently composing to the editor. The function is mostly needed by the input methods with text prediction features and by the methods where the script used for typing characters is different from the script that actually gets appended to the editor. Any kind of action that interrupts the text composing needs to flush the composing state by calling the commit() function, for example when the cursor is moved elsewhere. - Getter of property - cursorRectangleᅟ.- cursorRectangleChanged()¶
 - Notification signal of property - cursorRectangleᅟ.- hide()¶
 - Requests virtual keyboard to close. - Normally applications should not need to call this function, keyboard should automatically close when the text editor loses focus, for example when the parent view is closed. - inputDirection()¶
- Return type:
 
 - Getter of property - inputDirectionᅟ.- inputDirectionChanged(newDirection)¶
- Parameters:
- newDirection – - LayoutDirection
 
 - Notification signal of property - inputDirectionᅟ.- Getter of property - inputItemClipRectangleᅟ.- inputItemClipRectangleChanged()¶
 - Notification signal of property - inputItemClipRectangleᅟ.- Returns the input item’s geometry in input item coordinates. - See also - inputItemTransform()¶
- Return type:
 
 - Returns the transformation from input item coordinates to the window coordinates. - See also - Called by the input item when the word currently being composed is tapped by the user, as indicated by the action - aand the given- cursorPosition. Input methods often use this information to offer more word suggestions to the user.- isAnimating()¶
- Return type:
- bool 
 
 - Getter of property - animatingᅟ.- isVisible()¶
- Return type:
- bool 
 
 - Getter of property - visibleᅟ.- Getter of property - keyboardRectangleᅟ.- keyboardRectangleChanged()¶
 - Notification signal of property - keyboardRectangleᅟ.- Getter of property - localeᅟ.- localeChanged()¶
 - Notification signal of property - localeᅟ.- static queryFocusObject(query, argument)¶
- Parameters:
- query – - InputMethodQuery
- argument – object 
 
- Return type:
- object 
 
 - Send - queryto the current focus object with parameters- argumentand return the result.- reset()¶
 - Resets the input method state. For example, a text editor normally calls this method before inserting a text to make widget ready to accept a text. - Input method resets automatically when the focused editor changes. - Sets the input item’s geometry to be - rect, in input item coordinates. This needs to be updated by the focused window like QQuickCanvas whenever item is moved inside the scene, or focus is changed.- See also - setInputItemTransform(transform)¶
- Parameters:
- transform – - QTransform
 
 - Sets the transformation from input item coordinates to window coordinates to be - transform. Item transform needs to be updated by the focused window like QQuickCanvas whenever item is moved inside the scene.- See also - setVisible(visible)¶
- Parameters:
- visible – bool 
 
 - Controls the keyboard visibility. Equivalent to calling - show()(if- visibleis- true) or- hide()(if- visibleis- false).- See also - show()¶
 - Requests virtual keyboard to open. If the platform doesn’t provide virtual keyboard the visibility remains false. - Normally applications should not need to call this function, keyboard should automatically open when the text editor gains focus. - update(queries)¶
- Parameters:
- queries – Combination of - InputMethodQuery
 
 - Called by the input item to inform the platform input methods when there has been state changes in editor’s input method query attributes. When calling the function - queriesparameter has to be used to tell what has changes, which input method can use to make queries for attributes it’s interested with- QInputMethodQueryEvent.- In particular calling update whenever the cursor position changes is important as that often causes other query attributes like surrounding text and text selection to change as well. The attributes that often change together with cursor position have been grouped in Qt::ImQueryInput value for convenience. - visibleChanged()¶
 - Notification signal of property - visibleᅟ.