PDA

View Full Version : writing a username and password dialog



sergec
23rd April 2007, 11:28
Hi Everybody!

I would like to write a dialog asking the user for a username and password.
My difficulty lays on the password stuff. what libraries and functions are relative to the keyboard in order to mask the written password or
showing "stars" instead of the typed letters.
I have been looking for the different forums without any success.

Thank you!


Serge

marcel
23rd April 2007, 11:32
You can use a QLineEdit and the setEchoMode( QLineEdit::Password ).
This way any characters you type in will be displayed as asterisks.

Regards

vermarajeev
23rd April 2007, 14:30
You can use a QLineEdit and the setEchoMode( QLineEdit::Password ).
This way any characters you type in will be displayed as asterisks.

Regards

Yes, I too agree with that. If possible try overriding QLineEdit and you can can have more command like setting maxCharacters etc

jpn
23rd April 2007, 15:05
If possible try overriding QLineEdit and you can can have more command like setting maxCharacters etc
QLineEdit::setMaxLength() (http://doc.trolltech.com/4.2/qlineedit.html#maxLength-prop) ?

GreyGeek
25th April 2007, 17:18
Check out:
http://wiki.qtcentre.org/index.php?title=Programming_in_Qt4_and_C%2B%2B

About 1/3 the way down is an example of a login dialog and the necessary code.

That was the first program I wrote using C++ and QT. I'd do it differently now, making it more generic and reusable in other projects, but at least this is an example.

marcel
25th April 2007, 17:24
Yes, and that is a QLineEdit with password echo mode set.
It can't get more clearer than this.

Regards