emb-charinput.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 122 行
HTML
122 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/doc/charinput-qws.doc:36 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Character input in Qt/Embedded</title><style type="text/css"><!--h3.fn,span.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 Qt/Embedded</h1> <p> Internally in the client/server protocol, each key press and keyrelease is sent as a <tt>QWSKeyEvent</tt>. A QWSKeyEvent contains thefollowing fields:<p> <ul><li> <tt>unicode</tt><p> Unicode value<p> <li> <tt>keycode</tt><p> Qt keycode value as defined in qnamespace.h<p> <li> <tt>modifier</tt><p> A bitfield consisting of some of Qt::ShiftButton, Qt::ControlButton,and Qt::AltButton.<p> <li> <tt>is_press</tt><p> <tt>TRUE</tt> if this is a key press, <tt>FALSE</tt> if it is a key release.<p> <li> <tt>is_auto_repeat</tt><p> TRUE if this event is caused by auto repeat.<p> </ul><p> When the server receives a key event, it is sent to each clientprocess, which is responsible for processing the key event and sendingit to the right window, if any. Key events may come from severaldifferent sources.<p> <h2> Keyboard drivers</h2><a name="1"></a><p> A keyboard driver reads data from a device and gives key events to theserver.<p> Keyboard drivers are currently compiled into the library.They are defined in the file <tt>src/kernel/qkeyboard_qws.cpp</tt>.At the time of writing, the following drivers are defined:<center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#f0f0f0"><td valign="top"><tt>QWSTtyKeyboardHandler</tt><td valign="top">Input from the system console (tty)<tr bgcolor="#d0d0d0"><td valign="top"><tt>QWSVr41xxButtonsHandler</tt><td valign="top">Input handler for the buttons on Cassiopeia-style PDAs<tr bgcolor="#f0f0f0"><td valign="top"><tt>QWSVFbKeyboardHandler</tt><td valign="top">Virtual framebuffer key input</table></center><p> The keyboard drivers all follow the same pattern. They read keyboarddata from a device, find out which keys were pressed, and then callthe static function QWSServer::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, make a subclass of<a href="qwskeyboardhandler.html">QWSKeyboardHandler</a> and instantiate it in<tt>QWSServer::newKeyboardHandler()</tt> (in qkeyboard_qws.cpp).<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 firstpasses it through a filter. <p> This can be used to implement input methods, providing input ofcharacters that are not on the keyboard.<p> To make an input method, subclass QWSServer::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 tothe clients (using <a href="qwsserver.html#sendKeyEvent">QWSServer::sendKeyEvent</a>()). If <tt>filter()</tt> returns<tt>TRUE</tt>, the event will be stopped. To generate new key events, useQWSServer::sendKeyEvent(). (Do not use processKeyEvent(), since thiswill lead to infinite recursion.)<p> To install a keyboard event filter, use<a href="qwsserver.html#setKeyboardFilter">QWSServer::setKeyboardFilter</a>(). Currently, only one filtercan 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 serverprocess may call QWSServer::sendKeyEvent() at any time. <p> Typically, this is done by popping up a widget, and letting the userspecify characters with the pointer device.<p> <b>Note</b>: the key input widget should not take focus, since theserver 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 setthe <tt>WStyle_Customize</tt> and <tt>WStyle_Tool</tt> widget flags inthe <a href="qwidget.html">QWidget</a> constructor.<p> The <a href="http://www.trolltech.com/products/palmtop/">Qt Palmtop</a>environment contains various input widgets such asHandwriting Recognition and Virtual Keyboard.<p> <!-- eof --><p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright © 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?