1QIMEvent(3qt) QIMEvent(3qt)
2
3
4
6 QIMEvent - Parameters for input method events
7
9 #include <qevent.h>
10
11 Inherits QEvent.
12
13 Public Members
14 QIMEvent ( Type type, const QString & text, int cursorPosition )
15 const QString & text () const
16 int cursorPos () const
17 bool isAccepted () const
18 void accept ()
19 void ignore ()
20 int selectionLength () const
21
23 The QIMEvent class provides parameters for input method events.
24
25 Input method events are sent to widgets when an input method is used to
26 enter text into a widget. Input methods are widely used to enter text
27 in Asian and other complex languages.
28
29 The events are of interest to widgets that accept keyboard input and
30 want to be able to correctly handle complex languages. Text input in
31 such languages is usually a three step process.
32
33 <ol type=1>
34
35 1 Starting to Compose
36 When the user presses the first key on a keyboard an input
37 context is created. This input context will contain a string
38 with the typed characters.
39
40 2 Composing
41 With every new key pressed, the input method will try to create
42 a matching string for the text typed so far. While the input
43 context is active, the user can only move the cursor inside the
44 string belonging to this input context.
45
46 3 Completing
47 At some point, e.g. when the user presses the Spacebar, they get
48 to this stage, where they can choose from a number of strings
49 that match the text they have typed so far. The user can press
50 Enter to confirm their choice or Escape to cancel the input; in
51 either case the input context will be closed.
52
53 Note that the particular key presses used for a given input context may
54 differ from those we've mentioned here, i.e. they may not be Spacebar,
55 Enter and Escape.
56
57 These three stages are represented by three different types of events.
58 The IMStartEvent, IMComposeEvent and IMEndEvent. When a new input
59 context is created, an IMStartEvent will be sent to the widget and
60 delivered to the QWidget::imStartEvent() function. The widget can then
61 update internal data structures to reflect this.
62
63 After this, an IMComposeEvent will be sent to the widget for every key
64 the user presses. It will contain the current composition string the
65 widget has to show and the current cursor position within the
66 composition string. This string is temporary and can change with every
67 key the user types, so the widget will need to store the state before
68 the composition started (the state it had when it received the
69 IMStartEvent). IMComposeEvents will be delivered to the
70 QWidget::imComposeEvent() function.
71
72 Usually, widgets try to mark the part of the text that is part of the
73 current composition in a way that is visible to the user. A commonly
74 used visual cue is to use a dotted underline.
75
76 After the user has selected the final string, an IMEndEvent will be
77 sent to the widget. The event contains the final string the user
78 selected, and could be empty if they canceled the composition. This
79 string should be accepted as the final text the user entered, and the
80 intermediate composition string should be cleared. These events are
81 delivered to QWidget::imEndEvent().
82
83 If the user clicks another widget, taking the focus out of the widget
84 where the composition is taking place the IMEndEvent will be sent and
85 the string it holds will be the result of the composition up to that
86 point (which may be an empty string).
87
88 See also Event Classes.
89
92 Constructs a new QIMEvent with the accept flag set to FALSE. type can
93 be one of QEvent::IMStartEvent, QEvent::IMComposeEvent or
94 QEvent::IMEndEvent. text contains the current compostion string and
95 cursorPosition the current position of the cursor inside text.
96
98 Sets the accept flag of the input method event object.
99
100 Setting the accept parameter indicates that the receiver of the event
101 processed the input method event.
102
103 The accept flag is not set by default.
104
105 See also ignore().
106
108 Returns the current cursor position inside the composition string. Will
109 return -1 for IMStartEvent and IMEndEvent.
110
112 Clears the accept flag parameter of the input method event object.
113
114 Clearing the accept parameter indicates that the event receiver does
115 not want the input method event.
116
117 The accept flag is cleared by default.
118
119 See also accept().
120
122 Returns TRUE if the receiver of the event processed the event;
123 otherwise returns FALSE.
124
126 Returns the number of characters in the composition string ( starting
127 at cursorPos() ) that should be marked as selected by the input widget
128 receiving the event. Will return 0 for IMStartEvent and IMEndEvent.
129
131 Returns the composition text. This is a null string for an
132 IMStartEvent, and contains the final accepted string (which may be
133 empty) in the IMEndEvent.
134
135
137 http://doc.trolltech.com/qimevent.html
138 http://www.trolltech.com/faq/tech.html
139
141 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
142 license file included in the distribution for a complete license
143 statement.
144
146 Generated automatically from the source code.
147
149 If you find a bug in Qt, please report it as described in
150 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
151 help you. Thank you.
152
153 The definitive Qt documentation is provided in HTML format; it is
154 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
155 web browser. This man page is provided as a convenience for those users
156 who prefer man pages, although this format is not officially supported
157 by Trolltech.
158
159 If you find errors in this manual page, please report them to qt-
160 bugs@trolltech.com. Please include the name of the manual page
161 (qimevent.3qt) and the Qt version (3.3.8).
162
163
164
165Trolltech AS 2 February 2007 QIMEvent(3qt)