Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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":http://bugreports.qt.nokia.com. I can't think of any workarounds; hopefully others will have some ideas there.

    Regards,
    Michael




Log in to reply