Important: Please read the Qt Code of Conduct -

QKeyEvent::nativeScanCode in QML

  • Is there a way to get the native scan code of a key event in QML?

    I am using a proprietary keyboard that has things like fast forward, rewind, and some other keys on it. My qml app receives the pressed and released events but the event.key property contains -1. I wrote a test app using Qt and saw that the native scan code contains the value we need. I need all QML items to be able to us the Keys.onPressed: { ... } and see the native scan code.

  • Hi,

    Unfortunately, the native scan code isn't currently exposed (src/declarative/qdeclarativeevents_p_p.h is where the QML key event is defined). I'd recommend adding a suggestion for this in the "bug tracker": I can't think of any workarounds; hopefully others will have some ideas there.


Log in to reply