Important: Please read the Qt Code of Conduct -

Keypad works differently now?

  • My team just upgraded from Qt 5.10 to 5.13 and some keyboard shortcuts that were fine previously have quit working. In particular, we were using things such as Ctrl+[0-9] for changing one of our settings. While this always worked, and continued to work, for the numeric keys along the top of the keyboard, our users found it convenient to use the keypad's keys as well. This application is used on a laptop, not a mobile device.

    This is an example of how we specified the sequences:
    actions_.push_back(create_setting_action(tr("Setting Value 2"), QKeySequence{Qt::CTRL + Qt::Key_2}, Setting::SETTING_VALUE_2));

    Then in our key press handler we build a QKeySequence based on the QKeyEvent's modifiers and key() value, and see if an entry in actions_ has a matching sequence.

    I'm not sure why it worked in 5.10 but not in 5.13 and have seen other forums where people have had this problem going back to 5.12. We discovered that holding shift along with Ctrl and 2 on the keypad will create a match to the key sequence, but what I'm looking for is how to get our original functionality back, where Ctrl+2 (or any other numeric value on the keypad) will work for both the top row of the keyboard and the keypad.


    A teammate just pointed out to me that it's not just the keyboard shortcuts that aren't working, the keypad won't work for text input without holding down shift. Yes, I've checked NumLock. This only started with the upgrade from Qt 5.10 -> 5.13

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you check whether it also happens with Qt 5.12.4 ?

  • Unfortunately I can't check another Qt version quickly with my team's codebase and build system. That version number has seemed to be the culprit in what I've found searching the web for others with the same problem. I haven't found a way to mitigate the issue in those searches.

    Our Qt libraries are built from source, maybe there's a build setting that could have caused this issue? It definitely behaves as if it is ignoring num-lock entirely.

  • Lifetime Qt Champion

    I am not aware of such a setting since it's more of a system setting.

    In any case, can you share the options you are using ?

    By the way, 5.13.1 is about to be branched, it might be worth checking.

  • The only build options used with configure were -qt-xcb -no-reduce-relocations -nomake examples -nomake tests -opensource -confirm-license

    We're on Ubuntu 16.04, if that makes a difference.

Log in to reply