PythonQt.QtGui.QInputMethodEvent
QInputMethodEvent
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
Input method events are sent to widgets when an input method is used to enter text into a widget. Input methods are widely used to enter text for languages with non-Latin alphabets.
Note that when creating custom text editing widgets, the Qt::WA_InputMethodEnabled window attribute must be set explicitly (using the QWidget::setAttribute() function) in order to receive input method events.
The events are of interest to authors of keyboard entry widgets who want to be able to correctly handle languages with complex character input. Text input in such languages is usually a three step process:
- Starting to Compose
When the user presses the first key on a keyboard, an input context is created. This input context will contain a string of the typed characters. 2. Composing
With every new key pressed, the input method will try to create a matching string for the text typed so far called preedit string. While the input context is active, the user can only move the cursor inside the string belonging to this input context. 3. Completing
At some point, the user will activate a user interface component (perhaps using a particular key) where they can choose from a number of strings matching the text they have typed so far. The user can either confirm their choice cancel the input; in either case the input context will be closed.
QInputMethodEvent models these three stages, and transfers the information needed to correctly render the intermediate result. A QInputMethodEvent has two main parameters: preeditString() and commitString(). The preeditString() parameter gives the currently active preedit string. The commitString() parameter gives a text that should get added to (or replace parts of) the text of the editor widget. It usually is a result of the input operations and has to be inserted to the widgets text directly before the preedit string.
If the commitString() should replace parts of the of the text in the editor, replacementLength() will contain the number of characters to be replaced. replacementStart() contains the position at which characters are to be replaced relative from the start of the preedit string.
A number of attributes control the visual appearance of the preedit string (the visual appearance of text outside the preedit string is controlled by the widget only). The AttributeType enum describes the different attributes that can be set.
A class implementing QWidget::inputMethodEvent() or QGraphicsItem::inputMethodEvent() should at least understand and honor the TextFormat and Cursor attributes.
Since input methods need to be able to query certain properties from the widget or graphics item, subclasses must also implement QWidget::inputMethodQuery() and QGraphicsItem::inputMethodQuery(), respectively.
When receiving an input method event, the text widget has to performs the following steps:
- If the widget has selected text, the selected text should get removed.
- Remove the text starting at replacementStart() with length replacementLength() and replace it by the commitString(). If replacementLength() is 0, replacementStart() gives the insertion position for the commitString().
When doing replacement the area of the preedit string is ignored, thus a replacement starting at -1 with a length of 2 will remove the last character before the preedit string and the first character afterwards, and insert the commit string directly before the preedit string.
If the widget implements undo/redo, this operation gets added to the undo stack. 3. If there is no current preedit string, insert the preeditString() at the current cursor position; otherwise replace the previous preeditString with the one received from this event.
If the widget implements undo/redo, the preeditString() should not influence the undo/redo stack in any way.
The widget should examine the list of attributes to apply to the preedit string. It has to understand at least the TextFormat and Cursor attributes and render them as specified.
Source: https://doc.qt.io/archives/qt-5.15/qinputmethodevent.html
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
AcceptDropsChange |
attribute | Any |
(shared captured text) |
ActionAdded |
attribute | Any |
(shared captured text) |
ActionChanged |
attribute | Any |
(shared captured text) |
ActionRemoved |
attribute | Any |
(shared captured text) |
ActivateControl |
attribute | Any |
(shared captured text) |
ActivationChange |
attribute | Any |
(shared captured text) |
ApplicationActivate |
attribute | Any |
(shared captured text) |
ApplicationActivated |
attribute | Any |
(shared captured text) |
ApplicationDeactivate |
attribute | Any |
(shared captured text) |
ApplicationDeactivated |
attribute | Any |
(shared captured text) |
ApplicationFontChange |
attribute | Any |
(shared captured text) |
ApplicationLayoutDirectionChange |
attribute | Any |
(shared captured text) |
ApplicationPaletteChange |
attribute | Any |
(shared captured text) |
ApplicationStateChange |
attribute | Any |
(shared captured text) |
ApplicationWindowIconChange |
attribute | Any |
(shared captured text) |
Attribute |
attribute | type |
|
AttributeType |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
ChildAdded |
attribute | Any |
(shared captured text) |
ChildPolished |
attribute | Any |
(shared captured text) |
ChildRemoved |
attribute | Any |
(shared captured text) |
Clipboard |
attribute | Any |
(shared captured text) |
Close |
attribute | Any |
(shared captured text) |
CloseSoftwareInputPanel |
attribute | Any |
(shared captured text) |
ContentsRectChange |
attribute | Any |
(shared captured text) |
ContextMenu |
attribute | Any |
(shared captured text) |
Create |
attribute | Any |
(shared captured text) |
Cursor |
attribute | Any |
|
CursorChange |
attribute | Any |
(shared captured text) |
DeactivateControl |
attribute | Any |
(shared captured text) |
DeferredDelete |
attribute | Any |
(shared captured text) |
Destroy |
attribute | Any |
(shared captured text) |
DragEnter |
attribute | Any |
(shared captured text) |
DragLeave |
attribute | Any |
(shared captured text) |
DragMove |
attribute | Any |
(shared captured text) |
DragResponse |
attribute | Any |
(shared captured text) |
Drop |
attribute | Any |
(shared captured text) |
DynamicPropertyChange |
attribute | Any |
(shared captured text) |
EmbeddingControl |
attribute | Any |
(shared captured text) |
EnabledChange |
attribute | Any |
(shared captured text) |
Enter |
attribute | Any |
(shared captured text) |
EnterWhatsThisMode |
attribute | Any |
(shared captured text) |
Expose |
attribute | Any |
(shared captured text) |
FileOpen |
attribute | Any |
(shared captured text) |
FocusAboutToChange |
attribute | Any |
(shared captured text) |
FocusIn |
attribute | Any |
(shared captured text) |
FocusOut |
attribute | Any |
(shared captured text) |
FontChange |
attribute | Any |
(shared captured text) |
FutureCallOut |
attribute | Any |
(shared captured text) |
Gesture |
attribute | Any |
(shared captured text) |
GestureOverride |
attribute | Any |
(shared captured text) |
GrabKeyboard |
attribute | Any |
(shared captured text) |
GrabMouse |
attribute | Any |
(shared captured text) |
GraphicsSceneContextMenu |
attribute | Any |
(shared captured text) |
GraphicsSceneDragEnter |
attribute | Any |
(shared captured text) |
GraphicsSceneDragLeave |
attribute | Any |
(shared captured text) |
GraphicsSceneDragMove |
attribute | Any |
(shared captured text) |
GraphicsSceneDrop |
attribute | Any |
(shared captured text) |
GraphicsSceneHelp |
attribute | Any |
(shared captured text) |
GraphicsSceneHoverEnter |
attribute | Any |
(shared captured text) |
GraphicsSceneHoverLeave |
attribute | Any |
(shared captured text) |
GraphicsSceneHoverMove |
attribute | Any |
(shared captured text) |
GraphicsSceneMouseDoubleClick |
attribute | Any |
(shared captured text) |
GraphicsSceneMouseMove |
attribute | Any |
(shared captured text) |
GraphicsSceneMousePress |
attribute | Any |
(shared captured text) |
GraphicsSceneMouseRelease |
attribute | Any |
(shared captured text) |
GraphicsSceneMove |
attribute | Any |
(shared captured text) |
GraphicsSceneResize |
attribute | Any |
(shared captured text) |
GraphicsSceneWheel |
attribute | Any |
(shared captured text) |
HelpRequest |
attribute | Any |
(shared captured text) |
Hide |
attribute | Any |
(shared captured text) |
HideToParent |
attribute | Any |
(shared captured text) |
HoverEnter |
attribute | Any |
(shared captured text) |
HoverLeave |
attribute | Any |
(shared captured text) |
HoverMove |
attribute | Any |
(shared captured text) |
IconDrag |
attribute | Any |
(shared captured text) |
IconTextChange |
attribute | Any |
(shared captured text) |
InputMethod |
attribute | Any |
(shared captured text) |
InputMethodQuery |
attribute | Any |
(shared captured text) |
KeyPress |
attribute | Any |
(shared captured text) |
KeyRelease |
attribute | Any |
(shared captured text) |
KeyboardLayoutChange |
attribute | Any |
(shared captured text) |
Language |
attribute | Any |
|
LanguageChange |
attribute | Any |
(shared captured text) |
LayoutDirectionChange |
attribute | Any |
(shared captured text) |
LayoutRequest |
attribute | Any |
(shared captured text) |
Leave |
attribute | Any |
(shared captured text) |
LeaveWhatsThisMode |
attribute | Any |
(shared captured text) |
LocaleChange |
attribute | Any |
(shared captured text) |
MacGLClearDrawable |
attribute | Any |
(shared captured text) |
MacGLWindowChange |
attribute | Any |
(shared captured text) |
MacSizeChange |
attribute | Any |
(shared captured text) |
MaxUser |
attribute | Any |
(shared captured text) |
MetaCall |
attribute | Any |
(shared captured text) |
ModifiedChange |
attribute | Any |
(shared captured text) |
MouseButtonDblClick |
attribute | Any |
(shared captured text) |
MouseButtonPress |
attribute | Any |
(shared captured text) |
MouseButtonRelease |
attribute | Any |
(shared captured text) |
MouseMove |
attribute | Any |
(shared captured text) |
MouseTrackingChange |
attribute | Any |
(shared captured text) |
Move |
attribute | Any |
(shared captured text) |
NativeGesture |
attribute | Any |
(shared captured text) |
NetworkReplyUpdated |
attribute | Any |
(shared captured text) |
NonClientAreaMouseButtonDblClick |
attribute | Any |
(shared captured text) |
NonClientAreaMouseButtonPress |
attribute | Any |
(shared captured text) |
NonClientAreaMouseButtonRelease |
attribute | Any |
(shared captured text) |
NonClientAreaMouseMove |
attribute | Any |
(shared captured text) |
None_ |
attribute | Any |
(shared captured text) |
OkRequest |
attribute | Any |
(shared captured text) |
OrientationChange |
attribute | Any |
(shared captured text) |
Paint |
attribute | Any |
(shared captured text) |
PaletteChange |
attribute | Any |
(shared captured text) |
ParentAboutToChange |
attribute | Any |
(shared captured text) |
ParentChange |
attribute | Any |
(shared captured text) |
PlatformPanel |
attribute | Any |
(shared captured text) |
PlatformSurface |
attribute | Any |
(shared captured text) |
Polish |
attribute | Any |
(shared captured text) |
PolishRequest |
attribute | Any |
(shared captured text) |
QueryWhatsThis |
attribute | Any |
(shared captured text) |
Quit |
attribute | Any |
(shared captured text) |
ReadOnlyChange |
attribute | Any |
(shared captured text) |
RequestSoftwareInputPanel |
attribute | Any |
(shared captured text) |
Resize |
attribute | Any |
(shared captured text) |
Ruby |
attribute | Any |
|
ScreenChangeInternal |
attribute | Any |
(shared captured text) |
Scroll |
attribute | Any |
(shared captured text) |
ScrollPrepare |
attribute | Any |
(shared captured text) |
Selection |
attribute | Any |
(shared captured text) |
Shortcut |
attribute | Any |
(shared captured text) |
ShortcutOverride |
attribute | Any |
(shared captured text) |
Show |
attribute | Any |
(shared captured text) |
ShowToParent |
attribute | Any |
(shared captured text) |
ShowWindowRequest |
attribute | Any |
(shared captured text) |
SockAct |
attribute | Any |
(shared captured text) |
SockClose |
attribute | Any |
(shared captured text) |
Speech |
attribute | Any |
(shared captured text) |
StateMachineSignal |
attribute | Any |
(shared captured text) |
StateMachineWrapped |
attribute | Any |
(shared captured text) |
StatusTip |
attribute | Any |
(shared captured text) |
Style |
attribute | Any |
(shared captured text) |
StyleAnimationUpdate |
attribute | Any |
(shared captured text) |
StyleChange |
attribute | Any |
(shared captured text) |
TabletEnterProximity |
attribute | Any |
(shared captured text) |
TabletLeaveProximity |
attribute | Any |
(shared captured text) |
TabletMove |
attribute | Any |
(shared captured text) |
TabletPress |
attribute | Any |
(shared captured text) |
TabletRelease |
attribute | Any |
(shared captured text) |
TextFormat |
attribute | Any |
|
ThemeChange |
attribute | Any |
(shared captured text) |
ThreadChange |
attribute | Any |
(shared captured text) |
Timer |
attribute | Any |
(shared captured text) |
ToolBarChange |
attribute | Any |
(shared captured text) |
ToolTip |
attribute | Any |
(shared captured text) |
ToolTipChange |
attribute | Any |
(shared captured text) |
TouchBegin |
attribute | Any |
(shared captured text) |
TouchCancel |
attribute | Any |
(shared captured text) |
TouchEnd |
attribute | Any |
(shared captured text) |
TouchUpdate |
attribute | Any |
(shared captured text) |
Type |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
UngrabKeyboard |
attribute | Any |
(shared captured text) |
UngrabMouse |
attribute | Any |
(shared captured text) |
UpdateLater |
attribute | Any |
(shared captured text) |
UpdateRequest |
attribute | Any |
(shared captured text) |
User |
attribute | Any |
(shared captured text) |
WhatsThis |
attribute | Any |
(shared captured text) |
WhatsThisClicked |
attribute | Any |
(shared captured text) |
Wheel |
attribute | Any |
(shared captured text) |
WinEventAct |
attribute | Any |
(shared captured text) |
WinIdChange |
attribute | Any |
(shared captured text) |
WindowActivate |
attribute | Any |
(shared captured text) |
WindowBlocked |
attribute | Any |
(shared captured text) |
WindowChangeInternal |
attribute | Any |
(shared captured text) |
WindowDeactivate |
attribute | Any |
(shared captured text) |
WindowIconChange |
attribute | Any |
(shared captured text) |
WindowStateChange |
attribute | Any |
(shared captured text) |
WindowTitleChange |
attribute | Any |
(shared captured text) |
WindowUnblocked |
attribute | Any |
(shared captured text) |
ZOrderChange |
attribute | Any |
(shared captured text) |
ZeroTimerEvent |
attribute | Any |
(shared captured text) |
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
accept |
function | (self) -> Any |
(shared captured text) |
attributes |
function | (self) -> tuple |
X.attributes() -> tuple |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
commitString |
function | (self) -> str |
X.commitString() -> str |
delete |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deletes the C++ object (at your own risk, my friend!) (shared captured text) |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
ignore |
function | (self) -> Any |
(shared captured text) |
inherits |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns if the class inherits or is of given type name (shared captured text) |
isAccepted |
function | (self) -> bool |
X.isAccepted() -> bool (shared captured text) |
operator_assign |
function | (self, other: Any) -> Any |
X.operator_assign(other) -> PythonQt.QtCore.QEvent (shared captured text) |
preeditString |
function | (self) -> str |
X.preeditString() -> str |
registerEventType |
function | (self, hint: Any) -> int |
X.registerEventType(hint) -> int (shared captured text) |
replacementLength |
function | (self) -> int |
X.replacementLength() -> int |
replacementStart |
function | (self) -> int |
X.replacementStart() -> int |
setAccepted |
function | (self, accepted: Any) -> Any |
(shared captured text) |
setCommitString |
function | (self, commitString: str, replaceFrom: int, replaceLength: int) -> None |
X.setCommitString(commitString, replaceFrom, replaceLength) |
spontaneous |
function | (self) -> bool |
X.spontaneous() -> bool (shared captured text) |
type |
function | (self) -> Any |
(shared captured text) |