QInputMethodclass provides access to the active text input method. 更多 …
def
anchorRectangle
()
def
cursorRectangle
()
def
inputDirection
()
def
inputItemClipRectangle
()
def
inputItemRectangle
()
def
inputItemTransform
()
def
isAnimating
()
def
isVisible
()
def
keyboardRectangle
()
def
locale
()
def
setInputItemRectangle
(rect)
def
setInputItemTransform
(transform)
def
setVisible
(visible)
def
anchorRectangleChanged
()
def
animatingChanged
()
def
cursorRectangleChanged
()
def
inputDirectionChanged
(newDirection)
def
keyboardRectangleChanged
()
def
localeChanged
()
def
visibleChanged
()
def
queryFocusObject
(query, argument)
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 asQt.inputMethod特性。
PySide2.QtGui.QInputMethod.
Action
¶
Indicates the kind of action performed by the user.
|
常量 |
描述 |
|---|---|
|
QInputMethod.Click |
A normal click/tap |
|
QInputMethod.ContextMenu |
A context menu click/tap (e.g. right-button or tap-and-hold) |
另请参阅
PySide2.QtGui.QInputMethod.
anchorRectangle
(
)
¶
QRectF
PySide2.QtGui.QInputMethod.
anchorRectangleChanged
(
)
¶
PySide2.QtGui.QInputMethod.
animatingChanged
(
)
¶
PySide2.QtGui.QInputMethod.
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 function, for example when the cursor is moved elsewhere.
PySide2.QtGui.QInputMethod.
cursorRectangle
(
)
¶
QRectF
PySide2.QtGui.QInputMethod.
cursorRectangleChanged
(
)
¶
PySide2.QtGui.QInputMethod.
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.
PySide2.QtGui.QInputMethod.
inputDirection
(
)
¶
LayoutDirection
PySide2.QtGui.QInputMethod.
inputDirectionChanged
(
newDirection
)
¶
newDirection
–
LayoutDirection
PySide2.QtGui.QInputMethod.
inputItemClipRectangle
(
)
¶
QRectF
PySide2.QtGui.QInputMethod.
inputItemClipRectangleChanged
(
)
¶
PySide2.QtGui.QInputMethod.
inputItemRectangle
(
)
¶
QRectF
Returns the input item’s geometry in input item coordinates.
PySide2.QtGui.QInputMethod.
inputItemTransform
(
)
¶
Returns the transformation from input item coordinates to the window coordinates.
PySide2.QtGui.QInputMethod.
invokeAction
(
a
,
cursorPosition
)
¶
a
–
Action
cursorPosition
–
int
Called by the input item when the word currently being composed is tapped by the user, as indicated by the action
a
和给定
cursorPosition
. Input methods often use this information to offer more word suggestions to the user.
PySide2.QtGui.QInputMethod.
isAnimating
(
)
¶
bool
PySide2.QtGui.QInputMethod.
isVisible
(
)
¶
bool
PySide2.QtGui.QInputMethod.
keyboardRectangle
(
)
¶
QRectF
PySide2.QtGui.QInputMethod.
keyboardRectangleChanged
(
)
¶
PySide2.QtGui.QInputMethod.
locale
(
)
¶
QLocale
PySide2.QtGui.QInputMethod.
localeChanged
(
)
¶
PySide2.QtGui.QInputMethod.
queryFocusObject
(
query
,
argument
)
¶
query
–
InputMethodQuery
argument – object
object
发送
query
到当前聚焦对象采用参数
argument
并返回结果。
PySide2.QtGui.QInputMethod.
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.
PySide2.QtGui.QInputMethod.
setInputItemRectangle
(
rect
)
¶
rect
–
QRectF
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.
另请参阅
PySide2.QtGui.QInputMethod.
setInputItemTransform
(
transform
)
¶
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.
另请参阅
PySide2.QtGui.QInputMethod.
setVisible
(
visible
)
¶
visible
–
bool
控制键盘的可见性。相当于调用
show()
(if
visible
is
true
) or
hide()
(if
visible
is
false
).
另请参阅
PySide2.QtGui.QInputMethod.
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.
PySide2.QtGui.QInputMethod.
update
(
queries
)
¶
queries
–
InputMethodQueries
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
queries
parameter 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
ImQueryInput
value for convenience.
PySide2.QtGui.QInputMethod.
visibleChanged
(
)
¶