⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Keycodes for non-latin keyboards.

  • I'd like my software to be able to detect key presses from non-latin keyboards, for example Cyrillic. Not only are there not any key codes mentioned for any alphabet other than latin in the documentation, but when I switch my Mac's keyboard to Russian and type, no keyEvents are received at all. I tried it with Arabic and it doesn't work either. The letters appear on screen just fine, and the rest of the software has no problem interacting with them, but no key codes are given. Is there something that I need to do to tell Qt to query the current format, or is there no way to catch these events?

  • I've read that. And it talks a bit about how to handle the text, or keyboard modifiers, but those aren't the problems I'm having. The problem is that I receive no keyevents at all. For example, the following code will print "Here" if my keyboard is set to latin and I type a letter, but will print nothing if it is set to Russian and I type a letter.

    @bool MyTextEdit::eventFilter(QObject *object, QEvent *event)
    if (event->type() == QEvent::KeyPress) {

    As far as inputting, and working with the text, everything is fine. My spellchecking code works on Russian, the characters appear, I haven't tried saving a file yet, but I expect no difficulties in that either. But the keyboard is not sending any keyEvents. Is there something in that document that I missed which explains why? I've read it a couple of times now and still haven't seen a cause. From what I've read in the QKeyEvent documentation, I should at least be getting a keycode of 0.

    Furthermore, if I use keyPressEvent instead, like so:

    @void MyTextEdit::keyPressEvent ( QKeyEvent * event ) {

    When I type in English, "here" is printed, and no text appears on the screen because this function does nothing. If I type in Russian, the text appears on the screen and "here" is never printed.

  • Which Qt version are you using?

    Did you consider to "file a bug report":https://bugreports.qt-project.org/ ?

  • I'm using 4.8.2 on a Mac.

Log in to reply