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
|
'\" t
.TH QIMEvent 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QIMEvent \- Parameters for input method events
.SH SYNOPSIS
\fC#include <qevent.h>\fR
.PP
Inherits QEvent.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQIMEvent\fR ( Type type, const QString & text, int cursorPosition )"
.br
.ti -1c
.BI "const QString & \fBtext\fR () const"
.br
.ti -1c
.BI "int \fBcursorPos\fR () const"
.br
.ti -1c
.BI "bool \fBisAccepted\fR () const"
.br
.ti -1c
.BI "void \fBaccept\fR ()"
.br
.ti -1c
.BI "void \fBignore\fR ()"
.br
.ti -1c
.BI "int \fBselectionLength\fR () const"
.br
.in -1c
.SH DESCRIPTION
The QIMEvent class provides parameters for input method events.
.PP
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 in Asian and other complex languages.
.PP
The events are of interest to widgets that accept keyboard input and want to be able to correctly handle complex languages. Text input in such languages is usually a three step process.
.PP
<ol type=1>
.IP 1
\fBStarting to Compose\fR
.br
When the user presses the first key on a keyboard an input context is created. This input context will contain a string with the typed characters.
.IP 2
\fBComposing\fR
.br
With every new key pressed, the input method will try to create a matching string for the text typed so far. While the input context is active, the user can only move the cursor inside the string belonging to this input context.
.IP 3
\fBCompleting\fR
.br
At some point, e.g. when the user presses the Spacebar, they get to this stage, where they can choose from a number of strings that match the text they have typed so far. The user can press Enter to confirm their choice or Escape to cancel the input; in either case the input context will be closed.
.PP
Note that the particular key presses used for a given input context may differ from those we've mentioned here, i.e. they may not be Spacebar, Enter and Escape.
.PP
These three stages are represented by three different types of events. The IMStartEvent, IMComposeEvent and IMEndEvent. When a new input context is created, an IMStartEvent will be sent to the widget and delivered to the QWidget::imStartEvent() function. The widget can then update internal data structures to reflect this.
.PP
After this, an IMComposeEvent will be sent to the widget for every key the user presses. It will contain the current composition string the widget has to show and the current cursor position within the composition string. This string is temporary and can change with every key the user types, so the widget will need to store the state before the composition started (the state it had when it received the IMStartEvent). IMComposeEvents will be delivered to the QWidget::imComposeEvent() function.
.PP
Usually, widgets try to mark the part of the text that is part of the current composition in a way that is visible to the user. A commonly used visual cue is to use a dotted underline.
.PP
After the user has selected the final string, an IMEndEvent will be sent to the widget. The event contains the final string the user selected, and could be empty if they canceled the composition. This string should be accepted as the final text the user entered, and the intermediate composition string should be cleared. These events are delivered to QWidget::imEndEvent().
.PP
If the user clicks another widget, taking the focus out of the widget where the composition is taking place the IMEndEvent will be sent and the string it holds will be the result of the composition up to that point (which may be an empty string).
.PP
See also Event Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QIMEvent::QIMEvent ( Type type, const QString & text, int cursorPosition )"
Constructs a new QIMEvent with the accept flag set to FALSE. \fItype\fR can be one of QEvent::IMStartEvent, QEvent::IMComposeEvent or QEvent::IMEndEvent. \fItext\fR contains the current compostion string and \fIcursorPosition\fR the current position of the cursor inside \fItext\fR.
.SH "void QIMEvent::accept ()"
Sets the accept flag of the input method event object.
.PP
Setting the accept parameter indicates that the receiver of the event processed the input method event.
.PP
The accept flag is not set by default.
.PP
See also ignore().
.SH "int QIMEvent::cursorPos () const"
Returns the current cursor position inside the composition string. Will return -1 for IMStartEvent and IMEndEvent.
.SH "void QIMEvent::ignore ()"
Clears the accept flag parameter of the input method event object.
.PP
Clearing the accept parameter indicates that the event receiver does not want the input method event.
.PP
The accept flag is cleared by default.
.PP
See also accept().
.SH "bool QIMEvent::isAccepted () const"
Returns TRUE if the receiver of the event processed the event; otherwise returns FALSE.
.SH "int QIMEvent::selectionLength () const"
Returns the number of characters in the composition string ( starting at cursorPos() ) that should be marked as selected by the input widget receiving the event. Will return 0 for IMStartEvent and IMEndEvent.
.SH "const QString & QIMEvent::text () const"
Returns the composition text. This is a null string for an
IMStartEvent, and contains the final accepted string (which may be
empty) in the IMEndEvent.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qimevent.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (qimevent.3qt) and the Qt
version (3.3.8).
|