Distinguish input from virtual keyboard and real keyboard
-
I am developing an embedded application (with Qt 5 on Linux) in which users can input text on a touch screen with Qt's virtual keyboard. At the same time, a USB barcode scanner is attached which acts as a USB keyboard. Its data shall be processed independently, even while a user is typing on the virtual keyboard. Unfortunately, I receive KeyPress events from both of them. Is there a way to distinguish between events from the "real" (USB) and virtual keyboards so that I can filter the data?
-
@mr_max
most barcodescanner can be switched to serial mode, e.g. by scanning a special barcode (see the scanners manual).
then you must use QtSerialPort module to connect to the scanner via the serial port and receive the input.there is no other way to distinguish, since the driver integrates with the OS's input system (like a keyboard)
-
Thank you for the suggestion, @raven-worx . I eventually did it that way.