Chinaunix首页 | 论坛 | 博客
  • 博客访问: 685281
  • 博文数量: 207
  • 博客积分: 1743
  • 博客等级: 上尉
  • 技术积分: 2044
  • 用 户 组: 普通用户
  • 注册时间: 2012-08-20 14:36
文章分类

全部博文(207)

文章存档

2016年(24)

2015年(10)

2014年(50)

2013年(45)

2012年(78)

分类: LINUX

2014-09-24 16:00:59

Qt for Embedded Linux Character Input


When running a  application, it either runs as a server or connects to an existing server. The keyboard driver is loaded by the server application when it starts running, using Qt's .

Internally in the client/server protocol, all system generated events, including key events, are passed to the server application which then propagates the event to the appropriate client. Note that key events do not always come from a keyboard device, they can can also be generated by the server process using input widgets.

Input Widgets
The server process may call the static () function at any time. Typically, this is done by popping up a widget that enables the user specify characters with the pointer device.

Note that 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  widget flag in the  constructor.

The Qt Extended environment contains various input widgets such as Handwriting Recognition and Virtual Keyboard.

Available Keyboard Drivers

 provides ready-made drivers for the console (TTY) and the standard Linux Input Subsystem (USB, PS/2, ...). Run the configure script to list the available drivers:

 ./configure -help

Note that only the console (TTY) keyboard driver handles console switching (Ctrl+Alt+F1, ...,Ctrl+Alt+F10) and termination (Ctrl+Alt+Backspace).

In the default Qt configuration, only the "TTY" driver is enabled. The various drivers can be enabled and disabled using the configure script. For example:

 configure -qt-kbd-linuxinput

Custom keyboard drivers can be implemented by subclassing the  class and creating a keyboard driver plugin (derived from the  class). The default implementation of the class will automatically detect the plugin, loading the driver into the server application at run-time.

Keymaps

Starting with 4.6,  has gained support for user defined keymaps. Keymap handling is supported by the built-in keyboard drivers TTY and LinuxInput. Custom keyboard drivers can use the existing keymap handling code via ().

By default Qt will use an internal, compiled-in US keymap. See the options below for how to load a different keymap.

Specifying a Keyboard Driver

To specify which driver to use, set the  environment variable. For example (if the current shell is bash, ksh, zsh or sh):

 export QWS_KEYBOARD=[:]

The  arguments are TTY, LinuxInput and  identifying custom drivers, and the driver specific options are typically a device, e.g., /dev/tty0.

Multiple keyboard drivers can be specified in one go:

 export QWS_KEYBOARD="[:]
         [:]
         [:]"

Input will be read from all specified drivers.

Currently the following options are supported by both the TTY and LinuxInput driver:

Option Description
/dev/xxx Open the specified device, instead of the driver's default device.
repeat-delay= Time (in milliseconds) until auto-repeat kicks in.
repeat-rate= Time (in milliseconds) specifying the interval between auto-repeats.
keymap=xx.qmap File name of a keymap file in Qt's qmap format. See  for instructions on how to create thoes files.
Note that the file name can of course also be the name of a .
disable-zap Disable the QWS server "Zap" shortcut Ctrl+Alt+Backspace
enable-compose Activate Latin-1 composing features in the built-in US keymap. You can use the right AltGr or right Alt is used as a dead key modifier, while AltGr+. is the compose key. For example:
  • AltGr + " + u = ü (u with diaeresis / umlaut u)
  • AltGr + . + / + o = ? (slashed o)
阅读(1351) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~