Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Map character to another language



  • Hello,
    I try to implement soft keyboard with multiple language support in Qt (widgets) and I have a problem with leter "translation" to different languages.
    Basically what I have is bunch of buttons on form with key code like Qt::Key_A etc. Now I want to i.e. switch language to German so key Y is now Z and Z if now Y.
    How would I go about doing such conversion?

    And I'm looking for Qt solution == OS independent solution.
    Note that I don't want to change OS keyboard layout or / and input language.



  • I would do it as a real "keyboard":http://en.wikipedia.org/wiki/Scancode does it.
    Assign a code for each button and provide a translation table from a code to a character.
    For example let say left lower button has a code 0x7A. When widget draws the button it will ask a translator what character to draw on a button with code 0x7A.
    When the button is pressed widget will emit a signal with this code and whoever listen for the signal will get code and translate it to 'Z' in one case or to 'Y' in another.


Log in to reply