Results 1 to 6 of 6

Thread: writing a username and password dialog

  1. #1
    Join Date
    Apr 2007
    Posts
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default writing a username and password dialog

    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

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: writing a username and password dialog

    You can use a QLineEdit and the setEchoMode( QLineEdit::Password ).
    This way any characters you type in will be displayed as asterisks.

    Regards

  3. #3
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: writing a username and password dialog

    Quote Originally Posted by marcel View Post
    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

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: writing a username and password dialog

    Quote Originally Posted by vermarajeev View Post
    If possible try overriding QLineEdit and you can can have more command like setting maxCharacters etc
    QLineEdit::setMaxLength() ?
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    Lincoln, NE USA
    Posts
    177
    Thanks
    3
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: writing a username and password dialog

    Check out:
    http://wiki.qtcentre.org/index.php?t...t4_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.

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: writing a username and password dialog

    Yes, and that is a QLineEdit with password echo mode set.
    It can't get more clearer than this.

    Regards

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.