Reputation: 11
I want to display something on the screen as long as a certain key combination is pressed (using Qt4.x). It has to be an configurable application-wide shortcut, so I'd like to do this with a QAction with an attached shortcut. The problem is that there seems to be no way to detect when the user releases the shortcut. I tried with a one-shot timer, in combination with the auto-repeat option, but this is unreliable and there is a delay before the hide-method is called.
Upvotes: 1
Views: 1723
Reputation: 27027
Using the shortcut mechanism provided by Qt, you can only react to the key combination being activated.
Why do you need to detec the key release ? If you need it, maybe you'll have to do reimplement the keyPressEvent and keyReleaseEvent functions, but before that, I would think twice if detecting the key release is really needed.
Upvotes: 4