Unsolved keyPressEvent not being driven
I'm clearly missing a crucial piece of setup for a custom QWidget.
The ctor says:
setFocusPolicy(Qt::StrongFocus); // Make sure we get key events.
but the keyPressEvent mf() is never driven :(
protected: void keyPressEvent(QKeyEvent * event) override;
What have I missed?
Your custom widget must have the focus.
Well I clicked on it and that should have given it focus (shouldn't it)?
Can anyone clarify what I need to do to get those events
JonB last edited by
I don't know, but you may not be getting any responses because nobody thinks there ought be any problem? Are you able to test just this in a totally standalone program, not with whatever you have in your current application?
Perdrix last edited by Perdrix
@JonB I can make the source of the custom Widget available to play with if you wish - you'd just need to stick into a main window or dlg.
let me know if you'd like me to do that and I'll stick a small zip file somewhere you can grab it from.