handle KeyEvent in C++
-
wrote on 12 Apr 2018, 07:54 last edited by
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?
-
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?
wrote on 17 Apr 2018, 10:31 last edited by@BePie
inherit QQuickview and override keypressEventclass MyQuickView : public QQuickView{
public:
void keyPressEvent(QKeyEvent * event){
}
} -
wrote on 17 Apr 2018, 12:19 last edited by
thanks,
I missed it because I usually used
QQmlEngine
or something alike and not aQQuickView
.
1/3