Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-37874

Inconsistent keyrelease and keypress events between iOS, Android and desktop Os when using bluetooth HID barcode scanner

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.2.1
    • None
    • iOS 7.*, Android (Samsung Galaxy Tab), bluetooth barcode reader is OPN-3002n. Same barcode reader is used in every case. No barcode reader specific software was installed to the devices, so it should use the same protocol in every case.
    • iOS/tvOS/watchOS

      Different operating systems get highly different keypress/keyrelease events from bluetooth barcode scanner that is connected to the device as a bluetooth HID keyboard.

      Events are filtered:
      qApp->installEventFilter(this);

      And printed:

      bool HandyBarcode::eventFilter(QObject *obj, QEvent *e)
      {
      Q_UNUSED(obj);
      if (e->type() == QEvent::KeyRelease || e->type() == QEvent::KeyPress)

      { qDebug() << e; }

      Differencies between operating system:

      iOS: Gets both KeyPress and KeyRelease events, but only when input focus is in an input text field. (I would want to get them always, regardless of the focus).

      Android: Gets only KeyRelease events for characters, Keypress and Keyrelease events are got for shift key.

      In desktop operating systems (Windows) pressing X (or reading with barcode reader) results to these events:
      QKeyEvent(KeyPress, 1000020, 2000000, """", false, 1)
      QKeyEvent(KeyPress, 58, 2000000, ""X"", false, 1)
      QKeyEvent(KeyRelease, 58, 2000000, ""X"", false, 1)
      QKeyEvent(KeyRelease, 1000020, 0, """", false, 1)

      In iOS result is (nearly the same, except keyrelease is without shif modifier and text is small x):
      QKeyEvent(KeyPress, 1000020, 2000000, """", false, 1)
      QKeyEvent(KeyPress, 58, 2000000, ""X"", false, 1)
      QKeyEvent(KeyRelease, 58, 0, ""x"", false, 1)
      QKeyEvent(KeyRelease, 1000020, 0, """", false, 1)

      In Android result is - no keyPress for X + in keyrelease x is with small letters:
      D/Qt ( 4012): ..\..\client\src\core\handybarcode.cpp:68 (virtual bool HandyBarcode::eventFilter(QObject*, QEvent*)): QKeyEvent(KeyPress, 1000020, 0, ""
      D/Qt ( 4012): ..\..\client\src\core\handybarcode.cpp:68 (virtual bool HandyBarcode::eventFilter(QObject*, QEvent*)): QKeyEvent(KeyRelease, 1000020, 2000000, ""
      D/Qt ( 4012): ..\..\client\src\core\handybarcode.cpp:68 (virtual bool HandyBarcode::eventFilter(QObject*, QEvent*)): QKeyEvent(KeyRelease, 58, 0, ""x"", false, 1)

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            richard Richard Moe Gustavsen
            ile Ilkka Pärssinen
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes