File: qinputcontext.html

package info (click to toggle)
python-qt4 4.12.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 40,300 kB
  • ctags: 6,185
  • sloc: python: 125,988; cpp: 13,291; xml: 292; makefile: 246; php: 27; sh: 2
file content (241 lines) | stat: -rw-r--r-- 16,922 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QInputContext Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QInputContext Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QInputContext class abstracts the input method dependent
data and composing state. <a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qinputcontext.html#StandardFormat-enum">StandardFormat</a></b> { PreeditFormat, SelectionFormat }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qinputcontext.html#QInputContext">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />unknown-type <b><a href="qinputcontext.html#actions">actions</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qinputcontext.html#filterEvent">filterEvent</a></b> (<i>self</i>, QEvent&#160;<i>event</i>)</li><li><div class="fn" />QWidget <b><a href="qinputcontext.html#focusWidget">focusWidget</a></b> (<i>self</i>)</li><li><div class="fn" />QFont <b><a href="qinputcontext.html#font">font</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qinputcontext.html#identifierName">identifierName</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qinputcontext.html#isComposing">isComposing</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qinputcontext.html#language">language</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qinputcontext.html#mouseHandler">mouseHandler</a></b> (<i>self</i>, int&#160;<i>x</i>, QMouseEvent&#160;<i>event</i>)</li><li><div class="fn" /><b><a href="qinputcontext.html#reset">reset</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qinputcontext.html#sendEvent">sendEvent</a></b> (<i>self</i>, QInputMethodEvent&#160;<i>event</i>)</li><li><div class="fn" /><b><a href="qinputcontext.html#setFocusWidget">setFocusWidget</a></b> (<i>self</i>, QWidget&#160;<i>w</i>)</li><li><div class="fn" />QTextFormat <b><a href="qinputcontext.html#standardFormat">standardFormat</a></b> (<i>self</i>, StandardFormat&#160;<i>s</i>)</li><li><div class="fn" /><b><a href="qinputcontext.html#update">update</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qinputcontext.html#widgetDestroyed">widgetDestroyed</a></b> (<i>self</i>, QWidget&#160;<i>w</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QInputContext class abstracts the input method dependent
data and composing state.</p>
<p>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.</p>
<p>To abstract such different input method specific intermediate
information, Qt offers the QInputContext 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.</p>
<p>Multiple input contexts that belong to a single input method may
concurrently coexist. Suppose multi-window text editor. Each text
widget of window A and B holds different QInputContext instance
which contains different state information such as partially
composed text.</p>
<a id="groups-of-functions" name="groups-of-functions" />
<h3>Groups of Functions</h3>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Context</th>
<th>Functions</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td>Receiving information</td>
<td><a href="qinputcontext.html#x11FilterEvent">x11FilterEvent</a>(), <a href="qinputcontext.html#filterEvent">filterEvent</a>(), <a href="qinputcontext.html#mouseHandler">mouseHandler</a>()</td>
</tr>
<tr class="even" valign="top">
<td>Sending back composed text</td>
<td><a href="qinputcontext.html#sendEvent">sendEvent</a>()</td>
</tr>
<tr class="odd" valign="top">
<td>State change notification</td>
<td><a href="qinputcontext.html#setFocusWidget">setFocusWidget</a>(), <a href="qinputcontext.html#reset">reset</a>()</td>
</tr>
<tr class="even" valign="top">
<td>Context information</td>
<td><a href="qinputcontext.html#identifierName">identifierName</a>(), <a href="qinputcontext.html#language">language</a>(), <a href="qinputcontext.html#font">font</a>(), <a href="qinputcontext.html#isComposing">isComposing</a>()</td>
</tr>
</table>
<a id="licensing-information" name="licensing-information" />
<h3>Licensing Information</h3>
<div class="LegaleseLeft">
<p>Copyright (C) 2003-2004 immodule for Qt Project. All rights
reserved.</p>
<p>This file is written to contribute to Nokia Corporation and/or
its subsidiary(-ies) under their own license. You may use this file
under your Qt license. Following description is copied from their
original file headers. Contact immodule-qt@freedesktop.org if any
conditions of this licensing are not clear to you.</p>
</div>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="StandardFormat-enum" />QInputContext.StandardFormat</h3><table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QInputContext.PreeditFormat</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The preedit text.</td>
</tr>
<tr>
<td class="topAlign"><tt>QInputContext.SelectionFormat</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The selection text.</td>
</tr>
</table>
<p><b>See also</b> <a href="qinputcontext.html#standardFormat">standardFormat</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QInputContext" />QInputContext.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an input context with the given <i>parent</i>.</p>


<h3 class="fn"><a name="actions" />unknown-type QInputContext.actions (<i>self</i>)</h3><p>This is a preliminary interface for Qt 4.</p>


<h3 class="fn"><a name="filterEvent" />bool QInputContext.filterEvent (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>This function can be reimplemented in a subclass to filter input
events.</p>
<p>Return true if the <i>event</i> has been consumed. Otherwise,
the unfiltered <i>event</i> will be forwarded to widgets as
ordinary way. Although the input events have accept() and ignore()
methods, leave it untouched.</p>
<p><i>event</i> is currently restricted to events of these
types:</p>
<ul>
<li>CloseSoftwareInputPanel</li>
<li>KeyPress</li>
<li>KeyRelease</li>
<li>MouseButtonDblClick</li>
<li>MouseButtonPress</li>
<li>MouseButtonRelease</li>
<li>MouseMove</li>
<li>RequestSoftwareInputPanel</li>
</ul>
<p>But some input method related events such as <a href="qwheelevent.html">QWheelEvent</a> or <a href="qtabletevent.html">QTabletEvent</a> may be added in future.</p>
<p>The filtering opportunity is always given to the input context
as soon as possible. It has to be taken place before any other key
event consumers such as eventfilters and accelerators because some
input methods require quite various key combination and sequences.
It often conflicts with accelerators and so on, so we must give the
input context the filtering opportunity first to ensure all input
methods work properly regardless of application design.</p>
<p>Ordinary input methods require discrete key events to work
properly, so Qt's key compression is always disabled for any input
contexts.</p>
<p><b>See also</b> <a href="qkeyevent.html">QKeyEvent</a> and
<a href="qinputcontext.html#x11FilterEvent">x11FilterEvent</a>().</p>


<h3 class="fn"><a name="focusWidget" /><a href="qwidget.html">QWidget</a> QInputContext.focusWidget (<i>self</i>)</h3><p>Returns the widget that has an input focus for this input
context.</p>
<p>The return value may differ from holderWidget() if the input
context is shared between several text widgets.</p>
<p><b>Warning:</b> To ensure platform independence and support
flexible configuration of widgets, ordinary input methods should
not call this function directly.</p>
<p><b>See also</b> <a href="qinputcontext.html#setFocusWidget">setFocusWidget</a>().</p>


<h3 class="fn"><a name="font" /><a href="qfont.html">QFont</a> QInputContext.font (<i>self</i>)</h3><p>Returns the font of the current input widget</p>


<h3 class="fn"><a name="identifierName" />QString QInputContext.identifierName (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This function must be implemented in any subclasses to return
the identifier name of the input method.</p>
<p>Return value is the name to identify and specify input methods
for the input method switching mechanism and so on. The name has to
be consistent with <a href="qinputcontextplugin.html#keys">QInputContextPlugin.keys</a>().
The name has to consist of ASCII characters only.</p>
<p>There are two different names with different responsibility in
the input method domain. This function returns one of them. Another
name is called 'display name' that stands for the name for endusers
appeared in a menu and so on.</p>
<p><b>See also</b> <a href="qinputcontextplugin.html#keys">QInputContextPlugin.keys</a>() and
<a href="qinputcontextplugin.html#displayName">QInputContextPlugin.displayName</a>().</p>


<h3 class="fn"><a name="isComposing" />bool QInputContext.isComposing (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This function indicates whether InputMethodStart event had been
sent to the current focus widget. It is ensured that an input
context can send InputMethodCompose or InputMethodEnd event safely
if this function returned true.</p>
<p>The state is automatically being tracked through <a href="qinputcontext.html#sendEvent">sendEvent</a>().</p>
<p><b>See also</b> <a href="qinputcontext.html#sendEvent">sendEvent</a>().</p>


<h3 class="fn"><a name="language" />QString QInputContext.language (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This function must be implemented in any subclasses to return a
language code (e.g. "zh_CN", "zh_TW", "zh_HK", "ja", "ko", ...) of
the input context. If the input context can handle multiple
languages, return the currently used one. The name has to be
consistent with QInputContextPlugin.language().</p>
<p>This information will be used by language tagging feature in
<a href="qinputmethodevent.html">QInputMethodEvent</a>. It is
required to distinguish unified han characters correctly. It
enables proper font and character code handling. Suppose CJK-awared
multilingual web browser (that automatically modifies fonts in
CJK-mixed text) and XML editor (that automatically inserts lang
attr).</p>


<h3 class="fn"><a name="mouseHandler" />QInputContext.mouseHandler (<i>self</i>, int&#160;<i>x</i>, <a href="qmouseevent.html">QMouseEvent</a>&#160;<i>event</i>)</h3><p>This function can be reimplemented in a subclass to handle mouse
press, release, double-click, and move events within the preedit
text. You can use the function to implement mouse-oriented user
interface such as text selection or popup menu for candidate
selection.</p>
<p>The <i>x</i> parameter is the offset within the string that was
sent with the InputMethodCompose event. The alteration boundary of
<i>x</i> is ensured as character boundary of preedit string
accurately.</p>
<p>The <i>event</i> parameter is the event that was sent to the
editor widget. The event type is <a href="qevent.html#Type-enum">QEvent.MouseButtonPress</a>, <a href="qevent.html#Type-enum">QEvent.MouseButtonRelease</a>, <a href="qevent.html#Type-enum">QEvent.MouseButtonDblClick</a> or <a href="qevent.html#Type-enum">QEvent.MouseMove</a>. The event's button
and state indicate the kind of operation that was performed.</p>


<h3 class="fn"><a name="reset" />QInputContext.reset (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This function can be reimplemented in a subclass to reset the
state of the input method.</p>
<p>This function is called by several widgets to reset input state.
For example, a text widget call this function before inserting a
text to make widget ready to accept a text.</p>
<p>Default implementation is sufficient for simple input method.
You can override this function to reset external input method
engines in complex input method. In the case, call
QInputContext.reset() to ensure proper termination of
inputting.</p>
<p>In a reimplementation of reset(), you must not send any <a href="qinputmethodevent.html">QInputMethodEvent</a> containing preedit
text. You can only commit string and attributes; otherwise, you
risk breaking input state consistency.</p>


<h3 class="fn"><a name="sendEvent" />QInputContext.sendEvent (<i>self</i>, <a href="qinputmethodevent.html">QInputMethodEvent</a>&#160;<i>event</i>)</h3><p>Sends an input method event specified by <i>event</i> to the
current focus widget. Implementations of <a href="qinputcontext.html">QInputContext</a> should call this method to
send the generated input method events and not <a href="qcoreapplication.html#sendEvent">QApplication.sendEvent</a>(), as
the events might have to get dispatched to a different application
on some platforms.</p>
<p>Some complex input methods route the handling to several child
contexts (e.g. to enable language switching). To account for this,
<a href="qinputcontext.html">QInputContext</a> will check if the
parent object is a <a href="qinputcontext.html">QInputContext</a>.
If yes, it will call the parents sendEvent() implementation instead
of sending the event directly.</p>
<p><b>See also</b> <a href="qinputmethodevent.html">QInputMethodEvent</a>.</p>


<h3 class="fn"><a name="setFocusWidget" />QInputContext.setFocusWidget (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>w</i>)</h3><p>Sets the <i>widget</i> that has an input focus for this input
context.</p>
<p><b>Warning:</b> Ordinary input methods must not call this
function directly.</p>
<p><b>See also</b> <a href="qinputcontext.html#focusWidget">focusWidget</a>().</p>


<h3 class="fn"><a name="standardFormat" /><a href="qtextformat.html">QTextFormat</a> QInputContext.standardFormat (<i>self</i>, <a href="qinputcontext.html#StandardFormat-enum">StandardFormat</a>&#160;<i>s</i>)</h3><p>Returns a <a href="qtextformat.html">QTextFormat</a> object that
specifies the format for component <i>s</i>.</p>


<h3 class="fn"><a name="update" />QInputContext.update (<i>self</i>)</h3><p>This virtual function is called when a state in the focus widget
has changed. <a href="qinputcontext.html">QInputContext</a> can
then use <a href="qwidget.html#inputMethodQuery">QWidget.inputMethodQuery</a>() to
query the new state of the widget.</p>


<h3 class="fn"><a name="widgetDestroyed" />QInputContext.widgetDestroyed (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>w</i>)</h3><p>This virtual function is called when the specified <i>widget</i>
is destroyed. The <i>widget</i> is a widget on which this input
context is installed.</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.12.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt&#160;4.8.7</td></tr></table></div></address></body></html>