[Qt-interest] Detect keyboard keys?

Thiago Macieira thiago at kde.org
Fri Jun 17 07:31:55 CEST 2011


Em Thursday, 16 de June de 2011, às 17:26:36, John Weeks escreveu:
> On Jun 16, 2011, at 3:30 PM, Thiago Macieira wrote:
> 
> Thank you, Thiago.
> 
> >> Thank you, Nikos. I use that myself. Unfortunately, it doesn't include
> >> the caps lock key.
> > 
> > Because the caps lock being held down isn't a modifier. The Caps Lock
> > state is a modifier, though.
> 
> OK. I can see the sense in that.
> 
> Since Qt::KeyboardModifier does not contain anything about caps lock, I must
> assume that setting the caps lock state (presumably by pressing the caps
> lock key) turns on Qt::ShiftModifier, and Qt doesn't think we need to know
> that it results from caps lock instead of simply pressing the shift key.

No, that's not it. I meant that in X, the Caps Lock, Num Lock and Scroll Lock 
lock states are part of the modifier values. That isn't reflected in the Qt API 
though.

> What if I want to test the current state of the 'a' key?

Then you need to check your own state machine: have you received the KeyPress 
of that key and not the KeyRelease?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110617/764d17bf/attachment.bin 


More information about the Qt-interest-old mailing list