Page 1 of 1

Press and Release Keys?

Posted: Tue Dec 18, 2018 7:03 am
by OGslinkyT
Is there a way to make a key that has one action when pressed down and another when released like a button? Or a way to bind a button to a key?

Just wondering because if not I think that would be a pretty cool feature.

Re: Press and Release Keys?

Posted: Wed Dec 19, 2018 10:17 pm
by SlySven
You would have to redesign the (bool) TCommandLine::event(QEvent *) code to handle QEvent::KeyRelease events as well as QEvent::KeyPress ones and then revise some of the down stream methods to allow them to process such things. One thing to bear in mind is that once you have a KeyPress you must eventually get a KeyRelease (well in perhaps 99.9999% of cases) so this isn't something that immediately jumps out as a necessity - although I guess adding this sort of thing would allow for the equivalent to chorded input with just a few keyboard (gamepad/game-mouse?) keys/buttons.

Re: Press and Release Keys?

Posted: Thu Dec 20, 2018 8:36 am
by Vadi
So what we're saying is that you can't right now, but it would be possible to add such a feature :)

Re: Press and Release Keys?

Posted: Thu Dec 20, 2018 6:33 pm
by SlySven
Yes - and maybe... ;)

How many keys being down that can be handled does, if I recall correctly depend on the keyboard hardware - and how many key-rollovers it supports: see Wikipedia article on Rollover (key) section n-key_rollover