Distinguish input from virtual keyboard and real keyboard
-
wrote on 10 Jan 2022, 19:14 last edited by
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?
-
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?
Moderatorswrote on 11 Jan 2022, 00:01 last edited by raven-worx 1 Nov 2022, 00:04@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)
-
wrote on 13 Jan 2022, 01:18 last edited by
Thank you for the suggestion, @raven-worx . I eventually did it that way.
3/3