You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
5.6 KiB
112 lines
5.6 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/charinput-qws.doc:36 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>Character input in TQt/Embedded</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>Character input in TQt/Embedded</h1>
|
|
|
|
|
|
|
|
<p> Internally in the client/server protocol, each key press and key
|
|
release is sent as a <tt>TQWSKeyEvent</tt>. A TQWSKeyEvent contains the
|
|
following fields:
|
|
<p> <center><table cellpadding="4" cellspacing="2" border="0">
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>unicode</tt>
|
|
<td valign="top">Unicode value
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>keycode</tt>
|
|
<td valign="top">TQt keycode value as defined in <a href="qnamespace-h.html">qnamespace.h</a>
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>modifier</tt>
|
|
<td valign="top">A bitfield consisting of some of <a href="qt.html#ButtonState-enum">TQt::ShiftButton</a>,
|
|
<a href="qt.html#ButtonState-enum">TQt::ControlButton</a>, and <a href="qt.html#ButtonState-enum">TQt::AltButton</a>.
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>is_press</tt>
|
|
<td valign="top">TRUE if this is a key press, FALSE if it is a key release.
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>is_auto_repeat</tt>
|
|
<td valign="top">TRUE if this event is caused by auto repeat.
|
|
</table></center>
|
|
<p> When the server receives a key event it is sent to each client process
|
|
which is responsible for processing the key event and sending it to
|
|
the right window, if any. Key events may come from several different
|
|
sources.
|
|
<p> <h2> Keyboard drivers
|
|
</h2>
|
|
<a name="1"></a><p> A keyboard driver reads data from a device and gives key events to the
|
|
server.
|
|
<p> Keyboard drivers can be compiled into the library or loaded as
|
|
plugins. Running ./configure -help lists the available keyboard drivers.
|
|
The "tty" driver is enabled in the default configuration.
|
|
<p> The keyboard drivers all follow the same pattern. They read keyboard
|
|
data from a device, find out which keys were pressed, and then call
|
|
the static function TQWSServer::processKeyEvent() with the key information.
|
|
<p> At present, the console keyboard driver also handles console switching
|
|
(<b>Ctrl+Alt-F1</b>...<b>Ctrl+Alt+F10</b>) and termination
|
|
(<b>Ctrl+Alt+Backspace</b>).
|
|
<p> To add a keyboard driver for a new device, subclasses of
|
|
<a href="qwskeyboardhandler.html">TQWSKeyboardHandler</a> and <a href="qkbddriverplugin.html">TQKbdDriverPlugin</a> can be
|
|
written and installed as plugins.
|
|
<p> <h2> Key event filters (input methods)
|
|
</h2>
|
|
<a name="2"></a><p> When the server receives a key event from a keyboard driver, it first
|
|
passes it through a filter.
|
|
<p> This can be used to implement input methods, providing input of
|
|
characters that are not on the keyboard.
|
|
<p> To make an input method, subclass TQWSServer::KeyboardFilter (in <tt>src/kernel/qwindowsystem_qws.h</tt>) and implement the virtual function <tt>filter()</tt>. If <tt>filter()</tt> returns <tt>FALSE</tt>, the event will be sent to
|
|
the clients (using <a href="qwsserver.html#sendKeyEvent">TQWSServer::sendKeyEvent</a>()). If <tt>filter()</tt> returns
|
|
<tt>TRUE</tt>, the event will be stopped. To generate new key events, use
|
|
TQWSServer::sendKeyEvent(). (Do not use processKeyEvent(), since this
|
|
will lead to infinite recursion.)
|
|
<p> To install a keyboard event filter, use
|
|
<a href="qwsserver.html#setKeyboardFilter">TQWSServer::setKeyboardFilter</a>(). Currently, only one filter
|
|
can be installed at a time.
|
|
<p> Filtering must be done in the server process.
|
|
<p> The launcher example contains an example of a simple input method,
|
|
<tt>SimpleIM</tt> which reads a substitution table from a file.
|
|
<p> <h2> Pen input
|
|
</h2>
|
|
<a name="3"></a><p> Key events do not need to come from a keyboard device. The server
|
|
process may call TQWSServer::sendKeyEvent() at any time.
|
|
<p> Typically, this is done by popping up a widget, and letting the user
|
|
specify characters with the pointer device.
|
|
<p> <b>Note</b>: the key input widget should not take focus, since the
|
|
server would then just send the key events back to the input widget.
|
|
One way to make sure that the input widget never takes focus is to set
|
|
the <tt>WStyle_Customize</tt> and <tt>WStyle_Tool</tt> widget flags in
|
|
the <a href="qwidget.html">TQWidget</a> constructor.
|
|
<p> The <a href="http://www.trolltech.com/products/qtopia/">TQtopia</a>
|
|
environment contains various input widgets such as
|
|
Handwriting Recognition and Virtual Keyboard.
|
|
<p>
|
|
<!-- eof -->
|
|
<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|