Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 1342

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qevent.cpp -->
  <title>QInputMethodEvent Class | Qt GUI 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QInputMethodEvent</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QInputMethodEvent Class</h1>
<!-- $$$QInputMethodEvent-brief -->
<p>The <a href="qinputmethodevent.html">QInputMethodEvent</a> class provides parameters for input method events. <a href="#details">More...</a></p>
<!-- @@@QInputMethodEvent -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QInputMethodEvent&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qevent.html">QEvent</a></td></tr></table></div><ul>
<li><a href="qinputmethodevent-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent-attribute.html">Attribute</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#AttributeType-enum">AttributeType</a></b> { TextFormat, Cursor, Language, Ruby, Selection }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#QInputMethodEvent">QInputMethodEvent</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#QInputMethodEvent-1">QInputMethodEvent</a></b>(const QString &amp;<i>preeditText</i>, const QList&lt;Attribute&gt; &amp;<i>attributes</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#QInputMethodEvent-2">QInputMethodEvent</a></b>(const QInputMethodEvent &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#dtor.QInputMethodEvent">~QInputMethodEvent</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QList&lt;Attribute&gt; &amp;</td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#attributes">attributes</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QString &amp;</td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#commitString">commitString</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QString &amp;</td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#preeditString">preeditString</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#replacementLength">replacementLength</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#replacementStart">replacementStart</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qinputmethodevent.html#setCommitString">setCommitString</a></b>(const QString &amp;<i>commitString</i>, int <i>replaceFrom</i> = 0, int <i>replaceLength</i> = 0)</td></tr>
</table></div>
<ul>
<li class="fn">6 public functions inherited from <a href="../qtcore/qevent.html#public-functions">QEvent</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qevent.html#properties">QEvent</a></li>
<li class="fn">1 static public member inherited from <a href="../qtcore/qevent.html#static-public-members">QEvent</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qevent.html#protected-variables">QEvent</a></li>
</ul>
<a name="details"></a>
<!-- $$$QInputMethodEvent-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qinputmethodevent.html">QInputMethodEvent</a> 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="../qtcore/qt.html#WidgetAttribute-enum">Qt::WA_InputMethodEnabled</a> window attribute must be set explicitly (using the <a href="../qtwidgets/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" type="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><a href="qinputmethodevent.html">QInputMethodEvent</a> models these three stages, and transfers the information needed to correctly render the intermediate result. A <a href="qinputmethodevent.html">QInputMethodEvent</a> 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="../qtwidgets/qwidget.html#inputMethodEvent">QWidget::inputMethodEvent</a>() or <a href="../qtwidgets/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="../qtwidgets/qwidget.html#inputMethodQuery">QWidget::inputMethodQuery</a>() and <a href="../qtwidgets/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" type="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 <a href="qinputmethodevent.html#preeditString">preeditString</a> 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>
</div>
<p><b>See also </b><a href="qinputmethod.html">QInputMethod</a>.</p>
<!-- @@@QInputMethodEvent -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$AttributeType$$$TextFormat$$$Cursor$$$Language$$$Ruby$$$Selection -->
<h3 class="fn" id="AttributeType-enum"><a name="AttributeType-enum"></a>enum QInputMethodEvent::<span class="name">AttributeType</span></h3>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QInputMethodEvent::TextFormat</code></td><td class="topAlign tblval"><code>0</code></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="../qtcore/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"><code>QInputMethodEvent::Cursor</code></td><td class="topAlign tblval"><code>1</code></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="../qtcore/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"><code>QInputMethodEvent::Language</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The variant contains a <a href="../qtcore/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"><code>QInputMethodEvent::Ruby</code></td><td class="topAlign tblval"><code>3</code></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"><code>QInputMethodEvent::Selection</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">If set, the edit cursor should be moved to the specified position in the editor text contents. In contrast with <code>Cursor</code>, 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></div>
<p><b>See also </b><a href="qinputmethodevent-attribute.html">Attribute</a>.</p>
<!-- @@@AttributeType -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QInputMethodEvent[overload1]$$$QInputMethodEvent -->
<h3 class="fn" id="QInputMethodEvent"><a name="QInputMethodEvent"></a>QInputMethodEvent::<span class="name">QInputMethodEvent</span>()</h3>
<p>Constructs an event of type <a href="../qtcore/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>
<!-- @@@QInputMethodEvent -->
<!-- $$$QInputMethodEvent$$$QInputMethodEventconstQString&constQList<Attribute>& -->
<h3 class="fn" id="QInputMethodEvent-1"><a name="QInputMethodEvent-1"></a>QInputMethodEvent::<span class="name">QInputMethodEvent</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>preeditText</i>, const <span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qinputmethodevent-attribute.html">Attribute</a></span>&gt; &amp;<i>attributes</i>)</h3>
<p>Constructs an event of type <a href="../qtcore/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>
<!-- @@@QInputMethodEvent -->
<!-- $$$QInputMethodEvent$$$QInputMethodEventconstQInputMethodEvent& -->
<h3 class="fn" id="QInputMethodEvent-2"><a name="QInputMethodEvent-2"></a>QInputMethodEvent::<span class="name">QInputMethodEvent</span>(const <span class="type"><a href="qinputmethodevent.html#QInputMethodEvent">QInputMethodEvent</a></span> &amp;<i>other</i>)</h3>
<p>Constructs a copy of <i>other</i>.</p>
<!-- @@@QInputMethodEvent -->
<!-- $$$~QInputMethodEvent[overload1]$$$~QInputMethodEvent -->
<h3 class="fn" id="dtor.QInputMethodEvent"><a name="dtor.QInputMethodEvent"></a>QInputMethodEvent::<span class="name">~QInputMethodEvent</span>()</h3>
<p>Destroys the instance of QInputMethodEvent.</p><!-- @@@~QInputMethodEvent -->
<!-- $$$attributes[overload1]$$$attributes -->
<h3 class="fn" id="attributes"><a name="attributes"></a>const <span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qinputmethodevent-attribute.html">Attribute</a></span>&gt; &amp;QInputMethodEvent::<span class="name">attributes</span>() const</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>
<!-- @@@attributes -->
<!-- $$$commitString[overload1]$$$commitString -->
<h3 class="fn" id="commitString"><a name="commitString"></a>const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;QInputMethodEvent::<span class="name">commitString</span>() const</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>
<!-- @@@commitString -->
<!-- $$$preeditString[overload1]$$$preeditString -->
<h3 class="fn" id="preeditString"><a name="preeditString"></a>const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;QInputMethodEvent::<span class="name">preeditString</span>() const</h3>
<p>Returns the preedit text, i.e&#x2e; 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>
<!-- @@@preeditString -->
<!-- $$$replacementLength[overload1]$$$replacementLength -->
<h3 class="fn" id="replacementLength"><a name="replacementLength"></a><span class="type">int</span> QInputMethodEvent::<span class="name">replacementLength</span>() const</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>
<!-- @@@replacementLength -->
<!-- $$$replacementStart[overload1]$$$replacementStart -->
<h3 class="fn" id="replacementStart"><a name="replacementStart"></a><span class="type">int</span> QInputMethodEvent::<span class="name">replacementStart</span>() const</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>
<!-- @@@replacementStart -->
<!-- $$$setCommitString[overload1]$$$setCommitStringconstQString&intint -->
<h3 class="fn" id="setCommitString"><a name="setCommitString"></a><span class="type">void</span> QInputMethodEvent::<span class="name">setCommitString</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>commitString</i>, <span class="type">int</span> <i>replaceFrom</i> = 0, <span class="type">int</span> <i>replaceLength</i> = 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>
<!-- @@@setCommitString -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>