I use a barcode scanner for my app, too. All works without problem for me.
Did you try to input the "key events" in a simple text editor of you OS. Which characters compared to the editor are missing in Qt ?
Anyway solved it. I needed to call grabKeyboard function from the MainWindow class, so this->grabKeyboard() is the line I needed to add when key_0 button is pressed so that MainWindow doesn't lose the keyboard focus, and then when released I needed to add the line this->releaseKeyboard() to resume normal behaviour, that is, other widgets can have the keyboard focus.
You need to accept the event so the parent knows that the event has been handled. Otherwise the event will go all children until someone accepts it or if none do, it will be ignored.
so keyEv->accept() should do the trick.
Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.