Steps to reproduce:
0) Select en_US keyboard
1) Press and hold Shift key
2) Press and hold key '2' (which is for '@' symbol)
3) Release Shift key
4) Release key '2'
In the result of this sequence the application gets a really weird sequnece of events:
1) QEvent::KeyPress -> Qt::Key_Shift
2) QEvent::KeyPress -> Qt::Key_At
3) QEvent::KeyRelease -> Qt::Key_Shift
4) QEvent::KeyRelease -> Qt::Key_2 # this key has never been pressed before!
The problem happens because key's scancode is converted into qt-key using the modifiers at the moment of the event generation, which makes the qt-key code for key '2' generated incorrectly.
I've made two patches for Krita's version of Qt (5.12.12) that fix this issue (Windows and Linux platforms only), though I'm not sure, perhaps it can be fixed in a more general way.
I don't have a patch for macOS yet, though the issue is reproducible there.