Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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?


  • Moderators

    @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)


  • Moderators

    @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.


Log in to reply