[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qevent.cpp:1761 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QIMEvent Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QIMEvent Class Reference</h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QIMEvent class provides parameters for input method events.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qevent-h.html">qevent.h</a>></tt>
|
---|
| 37 | <p>Inherits <a href="qevent.html">QEvent</a>.
|
---|
| 38 | <p><a href="qimevent-members.html">List of all member functions.</a>
|
---|
| 39 | <h2>Public Members</h2>
|
---|
| 40 | <ul>
|
---|
| 41 | <li class=fn><a href="#QIMEvent"><b>QIMEvent</b></a> ( Type type, const QString & text, int cursorPosition )</li>
|
---|
| 42 | <li class=fn>const QString & <a href="#text"><b>text</b></a> () const</li>
|
---|
| 43 | <li class=fn>int <a href="#cursorPos"><b>cursorPos</b></a> () const</li>
|
---|
| 44 | <li class=fn>bool <a href="#isAccepted"><b>isAccepted</b></a> () const</li>
|
---|
| 45 | <li class=fn>void <a href="#accept"><b>accept</b></a> ()</li>
|
---|
| 46 | <li class=fn>void <a href="#ignore"><b>ignore</b></a> ()</li>
|
---|
| 47 | <li class=fn>int <a href="#selectionLength"><b>selectionLength</b></a> () const</li>
|
---|
| 48 | </ul>
|
---|
| 49 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | The QIMEvent class provides parameters for input method events.
|
---|
| 53 | <p>
|
---|
| 54 | <p> Input method events are sent to widgets when an input method is
|
---|
| 55 | used to enter text into a widget. Input methods are widely used to
|
---|
| 56 | enter text in Asian and other complex languages.
|
---|
| 57 | <p> The events are of interest to widgets that accept keyboard input
|
---|
| 58 | and want to be able to correctly handle complex languages. Text
|
---|
| 59 | input in such languages is usually a three step process.
|
---|
| 60 | <p> <ol type=1>
|
---|
| 61 | <li> <b>Starting to Compose</b><br>
|
---|
| 62 | When the user presses the first key on a keyboard an input context
|
---|
| 63 | is created. This input context will contain a string with the
|
---|
| 64 | typed characters.
|
---|
| 65 | <p> <li> <b>Composing</b><br>
|
---|
| 66 | With every new key pressed, the input method will try to create a
|
---|
| 67 | matching string for the text typed so far. While the input context
|
---|
| 68 | is active, the user can only move the cursor inside the string
|
---|
| 69 | belonging to this input context.
|
---|
| 70 | <p> <li> <b>Completing</b><br>
|
---|
| 71 | At some point, e.g. when the user presses the Spacebar, they get
|
---|
| 72 | to this stage, where they can choose from a number of strings that
|
---|
| 73 | match the text they have typed so far. The user can press Enter to
|
---|
| 74 | confirm their choice or Escape to cancel the input; in either case
|
---|
| 75 | the input context will be closed.
|
---|
| 76 | </ol>
|
---|
| 77 | <p> Note that the particular key presses used for a given input
|
---|
| 78 | context may differ from those we've mentioned here, i.e. they may
|
---|
| 79 | not be Spacebar, Enter and Escape.
|
---|
| 80 | <p> These three stages are represented by three different types of
|
---|
| 81 | events. The IMStartEvent, IMComposeEvent and IMEndEvent. When a
|
---|
| 82 | new input context is created, an IMStartEvent will be sent to the
|
---|
| 83 | widget and delivered to the <a href="qwidget.html#imStartEvent">QWidget::imStartEvent</a>() function.
|
---|
| 84 | The widget can then update internal data structures to reflect
|
---|
| 85 | this.
|
---|
| 86 | <p> After this, an IMComposeEvent will be sent to the widget for
|
---|
| 87 | every key the user presses. It will contain the current
|
---|
| 88 | composition string the widget has to show and the current cursor
|
---|
| 89 | position within the composition string. This string is temporary
|
---|
| 90 | and can change with every key the user types, so the widget will
|
---|
| 91 | need to store the state before the composition started (the state
|
---|
| 92 | it had when it received the IMStartEvent). IMComposeEvents will be
|
---|
| 93 | delivered to the <a href="qwidget.html#imComposeEvent">QWidget::imComposeEvent</a>() function.
|
---|
| 94 | <p> Usually, widgets try to mark the part of the text that is part of
|
---|
| 95 | the current composition in a way that is visible to the user. A
|
---|
| 96 | commonly used visual cue is to use a dotted underline.
|
---|
| 97 | <p> After the user has selected the final string, an IMEndEvent will
|
---|
| 98 | be sent to the widget. The event contains the final string the
|
---|
| 99 | user selected, and could be empty if they canceled the
|
---|
| 100 | composition. This string should be accepted as the final text the
|
---|
| 101 | user entered, and the intermediate composition string should be
|
---|
| 102 | cleared. These events are delivered to <a href="qwidget.html#imEndEvent">QWidget::imEndEvent</a>().
|
---|
| 103 | <p> If the user clicks another widget, taking the focus out of the
|
---|
| 104 | widget where the composition is taking place the IMEndEvent will
|
---|
| 105 | be sent and the string it holds will be the result of the
|
---|
| 106 | composition up to that point (which may be an empty string).
|
---|
| 107 | <p>See also <a href="events.html">Event Classes</a>.
|
---|
| 108 |
|
---|
| 109 | <hr><h2>Member Function Documentation</h2>
|
---|
| 110 | <h3 class=fn><a name="QIMEvent"></a>QIMEvent::QIMEvent ( <a href="qevent.html#Type-enum">Type</a> type, const <a href="qstring.html">QString</a> & text, int cursorPosition )
|
---|
| 111 | </h3>
|
---|
| 112 |
|
---|
| 113 | <p> Constructs a new QIMEvent with the accept flag set to FALSE. <em>type</em> can be one of QEvent::IMStartEvent, QEvent::IMComposeEvent
|
---|
| 114 | or QEvent::IMEndEvent. <em>text</em> contains the current compostion
|
---|
| 115 | string and <em>cursorPosition</em> the current position of the cursor
|
---|
| 116 | inside <em>text</em>.
|
---|
| 117 |
|
---|
| 118 | <h3 class=fn>void <a name="accept"></a>QIMEvent::accept ()
|
---|
| 119 | </h3>
|
---|
| 120 |
|
---|
| 121 | <p> Sets the accept flag of the input method event object.
|
---|
| 122 | <p> Setting the accept parameter indicates that the receiver of the
|
---|
| 123 | event processed the input method event.
|
---|
| 124 | <p> The accept flag is not set by default.
|
---|
| 125 | <p> <p>See also <a href="#ignore">ignore</a>().
|
---|
| 126 |
|
---|
| 127 | <h3 class=fn>int <a name="cursorPos"></a>QIMEvent::cursorPos () const
|
---|
| 128 | </h3>
|
---|
| 129 |
|
---|
| 130 | <p> Returns the current cursor position inside the composition string.
|
---|
| 131 | Will return -1 for IMStartEvent and IMEndEvent.
|
---|
| 132 |
|
---|
| 133 | <h3 class=fn>void <a name="ignore"></a>QIMEvent::ignore ()
|
---|
| 134 | </h3>
|
---|
| 135 |
|
---|
| 136 | <p> Clears the accept flag parameter of the input method event object.
|
---|
| 137 | <p> Clearing the accept parameter indicates that the event receiver
|
---|
| 138 | does not want the input method event.
|
---|
| 139 | <p> The accept flag is cleared by default.
|
---|
| 140 | <p> <p>See also <a href="#accept">accept</a>().
|
---|
| 141 |
|
---|
| 142 | <h3 class=fn>bool <a name="isAccepted"></a>QIMEvent::isAccepted () const
|
---|
| 143 | </h3>
|
---|
| 144 |
|
---|
| 145 | <p> Returns TRUE if the receiver of the event processed the event;
|
---|
| 146 | otherwise returns FALSE.
|
---|
| 147 |
|
---|
| 148 | <h3 class=fn>int <a name="selectionLength"></a>QIMEvent::selectionLength () const
|
---|
| 149 | </h3>
|
---|
| 150 |
|
---|
| 151 | <p> Returns the number of characters in the composition string (
|
---|
| 152 | starting at <a href="#cursorPos">cursorPos</a>() ) that should be marked as selected by the
|
---|
| 153 | input widget receiving the event.
|
---|
| 154 | Will return 0 for IMStartEvent and IMEndEvent.
|
---|
| 155 |
|
---|
| 156 | <h3 class=fn>const <a href="qstring.html">QString</a> & <a name="text"></a>QIMEvent::text () const
|
---|
| 157 | </h3>
|
---|
| 158 |
|
---|
| 159 | <p> Returns the composition text. This is a null string for an
|
---|
| 160 | IMStartEvent, and contains the final accepted string (which may be
|
---|
| 161 | empty) in the IMEndEvent.
|
---|
| 162 |
|
---|
| 163 | <!-- eof -->
|
---|
| 164 | <hr><p>
|
---|
| 165 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 166 | Copyright © 1995-2007
|
---|
| 167 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 168 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 169 | <td>Copyright © 2007
|
---|
| 170 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 171 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 172 | </table></div></address></body>
|
---|
| 173 | </html>
|
---|