qt5.3.2 everywhere evdev keyboard&mouse

本文介绍了如何在Linuxfb平台上使用Qt5.3.2配置键盘、鼠标和触摸输入。关键参数包括-mtdev和-evdev,用于指定设备节点,如evdevkeyboard=/dev/input/input0和evdevmouse=/dev/input/input1。当没有窗口系统时,直接通过evdev或其他辅助库读取输入设备。此外,还提到了触摸屏可能需要tslib支持,并且支持热插拔输入设备。



看到没有?!最关键的参数:-mtdev   -evdev ,因为运行的时候需要输入:

./zsy.bin -platform linuxfb -plugin evdevkeyboard=/dev/input/input0 evdevmouse=/dev/input/input1




The linuxfb plugin allows specifying additional settings by passing them in theQT_QPA_PLATFORM environment variable or-platform command-line option. For example,QT_QPA_PLATFORM=linuxfb:fb=/dev/fb1 specifies that the framebuffer device/dev/fb1 should be used instead of the defaultfb0. Multiple settings can be specfified by separating them with a colon.

  • fb=/dev/fbN - Specifies the framebuffer devices. On multiple display setups this will typically allow running the application on different displays. For the time being there is no way to use multiple framebuffers from one Qt application.
  • size=<width>x<height> - Specifies the screen size in pixels. The plugin will try to query the display dimensions, both physical and logical, from the framebuffer device. This may not always lead to proper results however, and therefore it may become necessary to explicitly specify the values.
  • mmSize=<width>x<height> - Physical width and height in millimeters.
  • offset=<width>x<height> - Offset in pixels specifying the top-left corner of the screen. The default position is at(0, 0).
  • nographicsmodeswitch - Do not switch the virtual terminal to graphics mode (KD_GRAPHICS). In addition to switching to graphics mode, the blinking cursor and screen blanking are normally disabled too. When this parameter is set, these are also skipped.
  • tty=/dev/ttyN - Overrides the virtual console. Only used when nographicsmodeswitch is not set.

When no windowing system is present, the mouse, keyboard and touch input are read directly viaevdev or using helper libraries liketslib. Note that this requires that devices nodes/dev/input/event* are readable by the user. eglfs has all the evdev input handling code built-in, while linuxfb relies on the traditional and somewhat limited-plugin command-line parameters.

Input on linuxfb

To enable keyboard, mouse, touch or tablet support with linuxfb, pass QT_QPA_GENERIC_PLUGINS=evdevkeyboard,evdevmouse,evdevtouch,... in the environment or, alternatively,

-plugin evdevkeyboard,

-plugin evdevmouse,

-plugin evdevtouch, or

-plugin evdevtablet

on the command-line. Most of these can take a device node parameter, for example

QT_QPA_GENERIC_PLUGINS=evdevmouse:/dev/event1,

in case the Qt's automatic device discovery (based either on libudev or a walkthrough of/dev/input/event*) is not functional or misbehaving.


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 passing

-plugin tslib instead of evdevtouch.

To change the device, set the environment variable TSLIB_TSDEVICE or pass the device name on the command-line.


Mouse

The mouse cursor will show up whenever QT_QPA_EGLFS_HIDECURSOR (for eglfs) orQT_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, butonly 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.

On eglfs the mouse cursor will disappear and reappear appropriately.





评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值