Qt - Password field, warn about Caps-Lock

Narek picture Narek · Jun 3, 2010 · Viewed 8k times · Source

Is there any Qt-built-in method to warn user (with pop-up window) that CapsLock is switched on while password field is active?

I am currently using QLineEdit (is it good?) with setEchoMode(QLineEdit::Password).

Answer

Biber picture Biber · Jun 3, 2010

once the user presses a key, you should check if the it's upper case AND if the shift is being held. if shift is not held,and the input is uppercase,caps lock is on. also if shift is down,and the input is lowercase,caps lock is on too.