Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Solved] Using Standard KeyCodes
Forum Updated to NodeBB v4.3 + New Features

[Solved] Using Standard KeyCodes

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • McLionM Offline
    McLionM Offline
    McLion
    wrote on last edited by
    #1

    Hi
    On my embedded device I am getting keycodes by RS232 which I then send to the active widget.

    @QWidget *ActWidget = QApplication::focusWidget();
    if(ActWidget)
    { datastring.append(inData->mid(uNextPara.l += 1, uLenNextPara.c[0]));
    QKeyEvent keyPress(QEvent::KeyPress, datastring.toULong(), Qt::NoModifier);
    QApplication::sendEvent(ActWidget, &keyPress);
    QKeyEvent keyRelease(QEvent::KeyRelease, datastring.toULong(), Qt::NoModifier);
    QApplication::sendEvent(ActWidget, &keyRelease); }
    @
    This works as supposed.
    I now want to use standard keycodes (http://www.asquare.net/javascript/tests/KeyCode.html) instead of the rather unusual Qt value like 0x1000001 for a Tab.
    Is there any standard function available in Qt that translates from standard Keycodes to the Qt value?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What version of Qt are you currently using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • McLionM Offline
        McLionM Offline
        McLion
        wrote on last edited by
        #3

        I am bound to 4.6.3 on the embedded Linux Device.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then have a look at the QKeyMapper class, however beware it's a private API

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • McLionM Offline
            McLionM Offline
            McLion
            wrote on last edited by
            #5

            I did take a look. As far as I could see that does not bring a quick and easy solution for me.
            I think I'm going to write a simple lookup function/pointer and add a table.

            Thanks anyway.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              That's a quick and clean solution :)

              Happy coding !

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved