Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 808

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?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>QInputMethodEvent 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">QInputMethodEvent Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QInputMethodEvent class provides parameters for input method
events. <a href="#details">More...</a></p>

<p>Inherits <a href="qevent.html">QEvent</a>.</p><h3>Types</h3><ul><li><div class="fn" />class <b><a href="qinputmethodevent-attribute.html">Attribute</a></b></li><li><div class="fn" />enum <b><a href="qinputmethodevent.html#AttributeType-enum">AttributeType</a></b> { TextFormat, Cursor, Language, Ruby, Selection }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qinputmethodevent.html#QInputMethodEvent">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qinputmethodevent.html#QInputMethodEvent-2">__init__</a></b> (<i>self</i>, QString&#160;<i>preeditText</i>, list-of-QInputMethodEvent.Attribute&#160;<i>attributes</i>)</li><li><div class="fn" /><b><a href="qinputmethodevent.html#QInputMethodEvent-3">__init__</a></b> (<i>self</i>, QInputMethodEvent&#160;<i>other</i>)</li><li><div class="fn" />list-of-QInputMethodEvent.Attribute <b><a href="qinputmethodevent.html#attributes">attributes</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qinputmethodevent.html#commitString">commitString</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qinputmethodevent.html#preeditString">preeditString</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qinputmethodevent.html#replacementLength">replacementLength</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qinputmethodevent.html#replacementStart">replacementStart</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qinputmethodevent.html#setCommitString">setCommitString</a></b> (<i>self</i>, QString&#160;<i>commitString</i>, int&#160;<i>from</i>&#160;=&#160;0, int&#160;<i>length</i>&#160;=&#160;0)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QInputMethodEvent class provides parameters for input method
events.</p>
<p>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.</p>
<p>Note that when creating custom text editing widgets, the
<a href="qt.html#WidgetAttribute-enum">Qt.WA_InputMethodEnabled</a>
window attribute must be set explicitly (using the <a href="qwidget.html#setAttribute">QWidget.setAttribute</a>() function)
in order to receive input method events.</p>
<p>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:</p>
<ol class="1">
<li><b>Starting to Compose</b>
<p>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.</p>
</li>
<li><b>Composing</b>
<p>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.</p>
</li>
<li><b>Completing</b>
<p>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.</p>
</li>
</ol>
<p>QInputMethodEvent models these three stages, and transfers the
information needed to correctly render the intermediate result. A
QInputMethodEvent has two main parameters: <a href="qinputmethodevent.html#preeditString">preeditString</a>() and
<a href="qinputmethodevent.html#commitString">commitString</a>().
The <a href="qinputmethodevent.html#preeditString">preeditString</a>()
parameter gives the currently active preedit string. The <a href="qinputmethodevent.html#commitString">commitString</a>() 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.</p>
<p>If the <a href="qinputmethodevent.html#commitString">commitString</a>() should
replace parts of the of the text in the editor, <a href="qinputmethodevent.html#replacementLength">replacementLength</a>()
will contain the number of characters to be replaced. <a href="qinputmethodevent.html#replacementStart">replacementStart</a>()
contains the position at which characters are to be replaced
relative from the start of the preedit string.</p>
<p>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 <a href="qinputmethodevent.html#AttributeType-enum">AttributeType</a> enum
describes the different attributes that can be set.</p>
<p>A class implementing <a href="qwidget.html#inputMethodEvent">QWidget.inputMethodEvent</a>() or
<a href="qgraphicsitem.html#inputMethodEvent">QGraphicsItem.inputMethodEvent</a>()
should at least understand and honor the <a href="qinputmethodevent.html#AttributeType-enum">TextFormat</a> and
<a href="qinputmethodevent.html#AttributeType-enum">Cursor</a>
attributes.</p>
<p>Since input methods need to be able to query certain properties
from the widget or graphics item, subclasses must also implement
<a href="qwidget.html#inputMethodQuery">QWidget.inputMethodQuery</a>() and
<a href="qgraphicsitem.html#inputMethodQuery">QGraphicsItem.inputMethodQuery</a>(),
respectively.</p>
<p>When receiving an input method event, the text widget has to
performs the following steps:</p>
<ol class="1">
<li>If the widget has selected text, the selected text should get
removed.</li>
<li>Remove the text starting at <a href="qinputmethodevent.html#replacementStart">replacementStart</a>()
with length <a href="qinputmethodevent.html#replacementLength">replacementLength</a>()
and replace it by the <a href="qinputmethodevent.html#commitString">commitString</a>(). If
<a href="qinputmethodevent.html#replacementLength">replacementLength</a>()
is 0, <a href="qinputmethodevent.html#replacementStart">replacementStart</a>()
gives the insertion position for the <a href="qinputmethodevent.html#commitString">commitString</a>().
<p>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.</p>
<p>If the widget implements undo/redo, this operation gets added to
the undo stack.</p>
</li>
<li>If there is no current preedit string, insert the <a href="qinputmethodevent.html#preeditString">preeditString</a>() at the
current cursor position; otherwise replace the previous
preeditString with the one received from this event.
<p>If the widget implements undo/redo, the <a href="qinputmethodevent.html#preeditString">preeditString</a>() should
not influence the undo/redo stack in any way.</p>
<p>The widget should examine the list of attributes to apply to the
preedit string. It has to understand at least the <a href="qinputmethodevent.html#AttributeType-enum">TextFormat</a> and
Cursor attributes and render them as specified.</p>
</li>
</ol>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="AttributeType-enum" />QInputMethodEvent.AttributeType</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>QInputMethodEvent.TextFormat</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">A <a href="qtextcharformat.html">QTextCharFormat</a> for the part of the
preedit string specified by start and length. value contains a
<a href="qvariant.html">QVariant</a> of type <a href="qtextformat.html">QTextFormat</a> specifying rendering of this
part of the preedit string. There should be at most one format for
every part of the preedit string. If several are specified for any
character in the string the behaviour is undefined. A conforming
implementation has to at least honor the backgroundColor, textColor
and fontUnderline properties of the format.</td>
</tr>
<tr>
<td class="topAlign"><tt>QInputMethodEvent.Cursor</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">If set, a cursor should be shown inside the
preedit string at position start. The length variable determines
whether the cursor is visible or not. If the length is 0 the cursor
is invisible. If value is a <a href="qvariant.html">QVariant</a> of
type <a href="qcolor.html">QColor</a> this color will be used for
rendering the cursor, otherwise the color of the surrounding text
will be used. There should be at most one Cursor attribute per
event. If several are specified the behaviour is undefined.</td>
</tr>
<tr>
<td class="topAlign"><tt>QInputMethodEvent.Language</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The variant contains a <a href="qlocale.html">QLocale</a> object specifying the language of a
certain part of the preedit string. There should be at most one
language set for every part of the preedit string. If several are
specified for any character in the string the behavior is
undefined.</td>
</tr>
<tr>
<td class="topAlign"><tt>QInputMethodEvent.Ruby</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">The ruby text for a part of the preedit
string. There should be at most one ruby text set for every part of
the preedit string. If several are specified for any character in
the string the behaviour is undefined.</td>
</tr>
<tr>
<td class="topAlign"><tt>QInputMethodEvent.Selection</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">If set, the edit cursor should be moved to the
specified position in the editor text contents. In contrast with
<tt>Cursor</tt>, this attribute does not work on the preedit text,
but on the surrounding text. The cursor will be moved after the
commit string has been committed, and the preedit string will be
located at the new edit position. The start position specifies the
new position and the length variable can be used to set a selection
starting from that point. The value is unused.</td>
</tr>
</table>
<p><b>See also</b> <a href="qinputmethodevent-attribute.html">Attribute</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QInputMethodEvent" />QInputMethodEvent.__init__ (<i>self</i>)</h3><p>Constructs an event of type <a href="qevent.html#Type-enum">QEvent.InputMethod</a>. The <a href="qinputmethodevent.html#attributes">attributes</a>(), <a href="qinputmethodevent.html#preeditString">preeditString</a>(),
<a href="qinputmethodevent.html#commitString">commitString</a>(),
<a href="qinputmethodevent.html#replacementStart">replacementStart</a>(),
and <a href="qinputmethodevent.html#replacementLength">replacementLength</a>()
are initialized to default values.</p>
<p><b>See also</b> <a href="qinputmethodevent.html#setCommitString">setCommitString</a>().</p>


<h3 class="fn"><a name="QInputMethodEvent-2" />QInputMethodEvent.__init__ (<i>self</i>, QString&#160;<i>preeditText</i>, list-of-QInputMethodEvent.Attribute&#160;<i>attributes</i>)</h3><p>Construcs an event of type <a href="qevent.html#Type-enum">QEvent.InputMethod</a>. The preedit text
is set to <i>preeditText</i>, the attributes to
<i>attributes</i>.</p>
<p>The <a href="qinputmethodevent.html#commitString">commitString</a>(), <a href="qinputmethodevent.html#replacementStart">replacementStart</a>(),
and <a href="qinputmethodevent.html#replacementLength">replacementLength</a>()
values can be set using <a href="qinputmethodevent.html#setCommitString">setCommitString</a>().</p>
<p><b>See also</b> <a href="qinputmethodevent.html#preeditString">preeditString</a>() and
<a href="qinputmethodevent.html#attributes">attributes</a>().</p>


<h3 class="fn"><a name="QInputMethodEvent-3" />QInputMethodEvent.__init__ (<i>self</i>, <a href="qinputmethodevent.html">QInputMethodEvent</a>&#160;<i>other</i>)</h3><p>Constructs a copy of <i>other</i>.</p>


<h3 class="fn"><a name="attributes" />list-of-QInputMethodEvent.Attribute QInputMethodEvent.attributes (<i>self</i>)</h3><p>Returns the list of attributes passed to the <a href="qinputmethodevent.html">QInputMethodEvent</a> constructor. The
attributes control the visual appearance of the preedit string (the
visual appearance of text outside the preedit string is controlled
by the widget only).</p>
<p><b>See also</b> <a href="qinputmethodevent.html#preeditString">preeditString</a>() and
<a href="qinputmethodevent-attribute.html">Attribute</a>.</p>


<h3 class="fn"><a name="commitString" />QString QInputMethodEvent.commitString (<i>self</i>)</h3><p>Returns the 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.</p>
<p><b>See also</b> <a href="qinputmethodevent.html#setCommitString">setCommitString</a>(),
<a href="qinputmethodevent.html#preeditString">preeditString</a>(),
<a href="qinputmethodevent.html#replacementStart">replacementStart</a>(),
and <a href="qinputmethodevent.html#replacementLength">replacementLength</a>().</p>


<h3 class="fn"><a name="preeditString" />QString QInputMethodEvent.preeditString (<i>self</i>)</h3><p>Returns the preedit text, i.e. the text before the user started
editing it.</p>
<p><b>See also</b> <a href="qinputmethodevent.html#commitString">commitString</a>() and
<a href="qinputmethodevent.html#attributes">attributes</a>().</p>


<h3 class="fn"><a name="replacementLength" />int QInputMethodEvent.replacementLength (<i>self</i>)</h3><p>Returns the number of characters to be replaced in the preedit
string.</p>
<p><b>See also</b> <a href="qinputmethodevent.html#replacementStart">replacementStart</a>()
and <a href="qinputmethodevent.html#setCommitString">setCommitString</a>().</p>


<h3 class="fn"><a name="replacementStart" />int QInputMethodEvent.replacementStart (<i>self</i>)</h3><p>Returns the position at which characters are to be replaced
relative from the start of the preedit string.</p>
<p><b>See also</b> <a href="qinputmethodevent.html#replacementLength">replacementLength</a>()
and <a href="qinputmethodevent.html#setCommitString">setCommitString</a>().</p>


<h3 class="fn"><a name="setCommitString" />QInputMethodEvent.setCommitString (<i>self</i>, QString&#160;<i>commitString</i>, int&#160;<i>from</i>&#160;=&#160;0, int&#160;<i>length</i>&#160;=&#160;0)</h3><p>Sets the commit string to <i>commitString</i>.</p>
<p>The commit string is the 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.</p>
<p>If the commit string should replace parts of the of the text in
the editor, <i>replaceLength</i> specifies the number of characters
to be replaced. <i>replaceFrom</i> specifies the position at which
characters are to be replaced relative from the start of the
preedit string.</p>
<p><b>See also</b> <a href="qinputmethodevent.html#commitString">commitString</a>(), <a href="qinputmethodevent.html#replacementStart">replacementStart</a>(),
and <a href="qinputmethodevent.html#replacementLength">replacementLength</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 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.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>