qt5输入的一些细节

原创 2015年07月06日 17:35:43

Input

When no windowing system is present,

the mouse, keyboard and touch input are read directly via evdev or using helper libraries like tslib.

Note that this requires that devices nodes /dev/input/event* are readable by the user.

eglfs and linuxfb has all the evdev input handling code built-in.

直接从evdev读入?

也就是说只要输入符合input规范,qt就能直接收到????也就是说

对于自定义键盘,要在驱动中转换为标准的按键值吗?

Input on eglfs and linuxfb

Parameters like the device node name can be set in the environment variables

QT_QPA_EVDEV_MOUSE_PARAMETERS//设备文件名可以使用这些环境变量指定

QT_QPA_EVDEV_KEYBOARD_PARAMETERS

and QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS. Additionally, the built-in input handlers can be disabled by setting QT_QPA_EGLFS_DISABLE_INPUT or QT_QPA_FB_DISABLE_INPUT to 1. On some touch screens the coordinates will need to be rotated. This can be enabled by setting QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS to rotate=180.

Mouse

The mouse cursor will show up whenever QT_QPA_EGLFS_HIDECURSOR (for eglfs) or

QT_QPA_FB_HIDECURSOR (for linuxfb)  //隐藏光标指针的功能呀???

is not set and Qt's libudev-based device discovery reports that at least one mouse is available. When libudev support is not present, the mouse cursor will always show up unless explicitly disabled via the environment variable.

Hot plugging is supported, but only if Qt was configured with libudev support (that is, if the libudev development headers are present in the sysroot at configure time). This allows connecting or disconnecting an input device while the application is running.

Keyboard

The evdev keyboard handler supports the following extra parameters:

  • /dev/input/... - Specifies the name of the input device. When not given, Qt will look for a suitable device either via libudev or by walking through the available nodes.
  • grab - Enables grabbing the input device.
  • keymap - Specifies the name of a custom keyboard map file.
  • enable-compose - Enables compositing.
  • repeat-delay - Sets a custom key repeat delay.
  • repeat-rate - Sets a custom key repeat rate.

On Embedded Linux systems that do not have their terminal sessions disabled, the behavior when pressing a key can be confusing due to having the input event processed both by the Qt application and the tty. To overcome this, the following options are available:

  • EGLFS, LinuxFB and KMS attempt to disable the terminal keyboard on application startup by setting the tty's keyboard mode to K_OFF. This prevents keystrokes from going to the terminal. If the standard behavior needs to be restored for some reason, set the environment variable QT_QPA_ENABLE_TERMINAL_KEYBOARD to 1. Note that this will not work when the application is launched from a remote console (for example, via ssh) and the terminal keyboard input will remain enabled.
  • An alternative approach is to use the evdev keyboard handler's grab parameter by passing grab=1 in QT_QPA_EVDEV_KEYBOARD_PARAMETERS. This results in trying to get a grab on the input device which, if successful, means that no other components in the system receive events from it as long as the Qt application is running. This approach is more suitable for applications started remotely as it does not need access to the tty device.
  • Finally, for many specialized Embedded Linux images it will not make sense to have the standard terminal sessions enabled in the first place. Refer to your build environment's documentation on how to disable them. For example, when generating images using the Yocto Project, unsetting SYSVINIT_ENABLED_GETTYS will result in having no getty process running, and thus no input, on any of the virtual terminals.

If the default, built-in keymap is not sufficient, a different one can be specified either via the keymap parameter or by using the eglfs-specific loadKeymap() function. The latter allows switching the keymap at runtime. Note however that this requires using eglfs' built-in keyboard handler; it is not supported when the keyboard handler is loaded via the -plugin command-line parameter.

Note: Special system key combinations, such as console switching (Ctrl+Alt+Fx) or zap (Ctrl+Alt+Backspace) are not currently supported and will get ignored.

To generate a custom keymap, the kmap2qmap utility can be used. This can be found in the qttools module. The source files have to be in standard Linux kmap format that is e.g. understood by the kernel's loadkeys command. This means one can use the following sources to generate qmap files:

  • The Linux Console Tools (LCT) project.
  • Xorg X11 keymaps can be converted to the kmap format with the ckbcomp utility.
  • As kmap files are plain text files, they can also be hand crafted.

kmap2qmap is a command line program, that needs at least 2 files as parameters. The last one will be the generated .qmap file, while all the others will be parsed as input .kmap files. For example:

kmap2qmap i386/qwertz/de-latin1-nodeadkeys.kmap include/compose.latin1.inc de-latin1-nodeadkeys.qmap

Note: kmap2qmap does not support all the (pseudo) symbols that the Linux kernel supports. When converting a standard keymap, a number of warnings will be shown regarding Show_Registers, Hex_A, and so on; these messages can safely be ignored.

Touch

For some resistive, single-touch touch screens it may be necessary to fall back to using tslib instead of relying on the Linux multitouch protocol and the event devices. For modern touch screens this should not be necessary. tslib support can be enabled by setting the environment variable QT_QPA_EGLFS_TSLIB or QT_QPA_FB_TSLIB to 1. To change the device, set the environment variable TSLIB_TSDEVICE or pass the device name on the command-line. Note that the tslib input handler generates mouse events and supports single touch only, as opposed to evdevtouch which generates true multi-touch QTouchEvent events too.

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

Qt libqevdevtouchplugin.so插件的改写

前段项目中用到了触摸屏,驱动已经做好,需要做一个触摸屏插件供ui调用,在网上查到了很多资料都是关于tslib的移植,由于之前键盘插件的开发是在qt官方提供的插件源码上修改的,这次也尝试着去改官方插件(...

qt5.3.2 everywhere evdev keyboard&mouse

看到没有?!最关键的参数:-mtdev   -evdev ,因为运行的时候需要输入: ./zsy.bin -platform linuxfb -plugin evdevkeyboard=/dev/in...

QT5.5.1 嵌入式平台 鼠标键盘不能热插拔问题解决(一)

前言:         由于项目需要,采用qt5.5.1开发界面,要求支持键鼠。经过uboot/kernel/fs的移植之后usb接口的热插拔已经OK,但是QT怎么也不支持热插拔,工作任务和强迫症双...

Qt5.3.0的移植安装与测试(交叉编译,用于arm,支持tslib触摸屏)

本文系统介绍了如何安装Qt5.3.0,运行armQt程序。

交叉编译Qt5.2.1让其支持触摸屏多点触摸

编译环境和上一篇一样.http://blog.csdn.net/mkndg/article/details/26359055 只是qt的configure不同,文件系统的profile不同.
  • MKNDG
  • MKNDG
  • 2014-05-23 17:25
  • 3730

Qt5.2.1交叉编译,带tslib插件

Qt 交叉编译
  • MKNDG
  • MKNDG
  • 2014-05-20 15:21
  • 4342

如何在QML中使用multitouch

在Qt QML中,它可以利用multitouch来做一些我们想做的事情。在今天的文章中,我们将介绍如何使用multitouch来做一些我们想做的事,比如在游戏中。

Linux输入子系统:多点触控协议 -- multi-touch-protocol.txt

Multi-touch (MT) Protocol -------------------------          Copyright(C) 2009-2010 Henrik Rydberg...

Qt5.3.2移植到到开发板上触摸屏不可用的问题,望指教.

交叉编译qt5.3.2后,能够运行进行触摸屏五点校准并生成校准文件,QT程序能够运行起来,但是点击界面的按钮和下拉框都没有反应,请问哪位大神移植过,望指教. 下面是环境变量配置文件: #tslib...

QT 4.8.5支持电容触摸屏 和 鼠标

近几天在搞QT4.8.5移植到ARM中,这里记录一下遇到的一些问题。 对于支持触摸屏,内核也是有要求的,与Android是不一样的,具体的可以参考:http://blog.csdn.net/orz41...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)