Solved handle KeyEvent in C++
-
With a c++ class that has a slot
void handleKeyEvent(QKeyEvent event); // or void handleKeyEvent(QKeySequence event);
I can only use (inside qml) QKeySequence version of the slot given event from Keys.pressed. Sadly, this results in an empty sequence (QKeySequence::toString() gives an empty string).
How one can handle those KeyEvents in a c++ class?
-
@BePie
inherit QQuickview and override keypressEventclass MyQuickView : public QQuickView{
public:
void keyPressEvent(QKeyEvent * event){
}
} -
thanks,
I missed it because I usually used
QQmlEngine
or something alike and not aQQuickView
.