[Interest] Changing key repeat settings in Qt

Kimmo Viitanen kviitanen at gmail.com
Mon Jan 30 16:57:19 CET 2012


On 01/30/2012 03:51 PM, Till Oliver Knoll wrote:
 > Hmmm, so you do a single move triggered by a key-press?
 >
 > IMHO it would be better to detect a key DOWN event instead and keep 
moving as long as that key is down (or in other words: until you receive 
a key UP event of the proper key).
 >
 > Wouldn't that be possible?
 >
 > Cheers, Oliver

Thanks!

I didn't originally see an easy way to accomplish this, since the 
documentation says that both a keyPressEvent and a keyReleaseEvent are 
sent on each auto-repeated press. But now after a quick test, it seems 
that isAutoRepeat() is false for the last keyReleaseEvent after a series 
of auto-repeated events, so based on this I can detect the physical 
press and release.

Cheers,

Kimmo



More information about the Interest mailing list