View Full Version : How to disable auto-repeat?

23rd February 2006, 17:18
Using keyPressEvent and keyReleaseEvent, I would like to disable auto-reapeating of keys.

The QT docs says this about keyPressEvent and keyReleaseEvent:

called whenever a key is pressed, and again when a key has been held down long enough for it to auto-repeat.

But nothing about how to diasble auto-repeating, it is possible? =]

24th February 2006, 10:20
You can programmatically prevent auto-repeat by ignoring the key event when it is an auto-repeat.

bool QKeyEvent::isAutoRepeat () const

Returns true if this event comes from an auto-repeating key; returns false if it comes from an initial key press.

Note that if the event is a multiple-key compressed event that is partly due to auto-repeat, this function could return either true or false indeterminately.