Using QLineEdit for passwords

fafa picture fafa · Apr 29, 2011 · Viewed 28.4k times · Source

How can I make a QLineEdit suitable for entering passwords (i.e. it doesn't show what's entered), something like the follwing:

enter image description here

Answer

evnu picture evnu · Apr 29, 2011

setEchoMode (Documentation) for your object.

Example code:

ui->lineEditPassword->setEchoMode(QLineEdit::Password);

You can do it from Qt Designer:

enter image description here