PDA

View Full Version : Masking password



Lebowski
14th April 2006, 09:56
Hello.

I'm working on application which is connecting to database. I have a popup window which requires user to enter password for database connection and I would like to mask characters which are being entered. The result is that user is typing his password and window displays just ********* instead of actual password. Any ideas how to do that?

ball
14th April 2006, 10:35
qLineEdit->setEchoMode(QLineEdit::Password);

Lebowski
14th April 2006, 10:49
Nice and simple. :) Thanx for help.

mcosta
14th April 2006, 12:17
...
The result is that user is typing his password and window displays just ********* instead of actual password. Any ideas how to do that?

You can use QInputDialog::getText().
The 3rd argument is echoMode of type QLineEdit::EchoMode, possible values are

QLineEdit::Normal
QLineEdit::NoEcho
QLineEdit::Password


You can write


QString password = QInputDialog::getText("Hello", "Insert your password", QLineEdit::Password);