Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
578 views
in Technique[技术] by (71.8m points)

internationalization - Qt Embedded for Linux. Keyboard layout switching

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?

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?

What would you suggest?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Version 4.6 has gained keymap support. Solution:

  1. generate kmap file:

    ckbcomp -layout xx > xx.kmap

  2. convert kmap to qmap

    kmap2qmap xx.kmap xx.qmap

  3. load keymap either by

    1. specifying QWS_KEYBOARD environment variable:

      QWS_KEYBOARD="TTY:keymap=xx.qmap"

    2. or loading a keymap dynamically:

      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.

Update

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...