Press and Release Keys?

Post Reply
OGslinkyT
Posts: 15
Joined: Thu Sep 06, 2018 5:26 am

Press and Release Keys?

Post 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.

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Press and Release Keys?

Post 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.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Press and Release Keys?

Post by Vadi »

So what we're saying is that you can't right now, but it would be possible to add such a feature :)

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Press and Release Keys?

Post 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

Post Reply