[Qt-interest] Detect keyboard keys?

Nikos Chantziaras realnc at arcor.de
Thu Jun 16 19:44:54 CEST 2011


On 06/16/2011 08:32 PM, John Weeks wrote:
> Is there a way to ask Qt if a certain key is currently pressed? I don't
> mean to receive a QKeyEvent; I want to ask if the caps lock key is
> currently down. It turns out we occasionally use caps lock as a mouse
> modifier. Maybe not the best design, but we're already doing it, and now
> I need to port it to Qt.
>
> Thanks!

QApplication::keyboardModifiers() might be useful.  It's a static method.

http://doc.trolltech.com/4.7/qapplication.html#keyboardModifiers



More information about the Qt-interest-old mailing list