How to get access to QKeyEvent(not KeyEvent) in QML?
Unsolved
QML and Qt Quick
-
Hey Mates
I need hints how to get passed QKeyEvent* for such code:
class Internals : public QObject { Q_OBJECT QML_ANONYMOUS public: explicit Internals(QObject *parent = nullptr); private slots: void emissionTest();//this just emits keyReleased with freshly created QKeyEvent 3s after instantiating Internals signals: void keyReleased(QKeyEvent *e); void longKeyPress(QKeyEvent *e); }; class Navigation : public QObject { Q_OBJECT QML_ATTACHED(Internals) public: explicit Navigation(QObject *parent = nullptr); static Internals* qmlAttachedProperties(QObject *object) { return new Internals(object); } }; //and somewhere in QML: Window { id: mainWindow Navigation.onKeyReleased: { console.log("Works! Key code: " + I'd like to get QKeyEvent here) } }
Regards,
MasterBLB -
@MasterBLB
Hi,
sorry I'm not QML developer, so more I can't help you.Maybe this can help you:
https://doc.qt.io/qt-5/qml-qtquick-keys.html