Qt Embedded for Linux.键盘布局切换 [英] Qt Embedded for Linux. Keyboard layout switching
问题描述
我正在使用Qt Embedded开发应用程序,并在linux framebuffer中运行它.我需要一种键入非美国字符的方法.是否可以使用Qt更改键盘布局?
I'm developing application with Qt Embedded and run it in linux framebuffer. I need a way to type non-US characters. Is it possible to change keyboard layout with Qt?
我试图在Qt/X11上运行它.布局切换和输入在这里非常好. 但是,当我使用Qt/Embedded对其进行编译并在帧缓冲区中运行时,我无法更改布局.
I tried to run it on Qt/X11. Layout switching and input are perfectly fine there. But when I compile it with Qt/Embedded and run it in framebuffer I cannot change layout.
我搜索了文档,但没有发现有关布局切换的任何信息.
I searched in the documentation and didn't find anything about layout switching.
我认为这与文档. 看来我应该开发自己的键盘驱动程序.但是我使用的是标准键盘,我认为必须有一种标准的方法来更改输入语言?
I think it has something to do with qt keyboard driver as specified at the documentation. It seems that I should develop my own keyboard driver. But I'm using standard keyboard and I think there must be a standard way to change input language?
您有什么建议?
顺便说一句,我使用的是4.5版本.也许4.6可以解决此问题?
BTW, I'm using 4.5 version. Maybe 4.6 has something to solve this issue?
在这里存在相同的问题:
Exact the same problem here:
http://lists.trolltech.com/pipermail/qt-embedded-interest/2008-August/000034.html
http://lists.trolltech.com/qt-interest/2004-02/msg00570.html
推荐答案
4.6版已获得键盘映射支持.解决方案:
Version 4.6 has gained keymap support. Solution:
-
生成kmap文件:
generate kmap file:
ckbcomp -layout xx> xx.kmap
ckbcomp -layout xx > xx.kmap
将kmap转换为qmap
convert kmap to qmap
kmap2qmap xx.kmap xx.qmap
kmap2qmap xx.kmap xx.qmap
通过以下方式加载键盘映射
load keymap either by
-
指定QWS_KEYBOARD环境变量:
specifying QWS_KEYBOARD environment variable:
QWS_KEYBOARD ="TTY:keymap = xx.qmap"
QWS_KEYBOARD="TTY:keymap=xx.qmap"
或动态加载键盘映射:
QWSKeyboardHandler * currentKeyboardHandler =
QKbdDriverFactory::create("TTY", "keymap=foo.qmap");
确保在创建新处理程序时删除创建的处理程序:
Make sure that you delete created handler when you create a new one:
delete currentKeyboardHandler;
currentKeyboardHandler =
QKbdDriverFactory::create("TTY", "keymap=bar.qmap");
灯塔项目.不过,不确定是否可以投入生产,我也不知道它如何处理键盘布局切换.
Seems like Qt for Embedded linux is superseeded by Project Lighthouse. Not sure though, if it is production ready, neither I know how does it handle keyboard layout switching.
更新
Qt5没有QWS,所有与QWS相关的API均已删除.因此,您需要一些第三方解决方案.或为 QPA 编写插件.
Qt5 doesn't have QWS and all QWS-related APIs are removed. So you'll need some thirdparty solution. Or write a plugin for QPA.
这篇关于Qt Embedded for Linux.键盘布局切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!