Results 1 to 4 of 4

Thread: Masking password

  1. #1
    Join Date
    Apr 2006
    Location
    Slovenia
    Posts
    33
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Masking password

    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?

  2. #2
    Join Date
    Jan 2006
    Posts
    75
    Thanks
    3
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Masking password

    qLineEdit->setEchoMode(QLineEdit::Password);

  3. The following user says thank you to ball for this useful post:

    Lebowski (14th April 2006)

  4. #3
    Join Date
    Apr 2006
    Location
    Slovenia
    Posts
    33
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Masking password

    Nice and simple. Thanx for help.

  5. #4
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Masking password

    Quote Originally Posted by Lebowski
    ...
    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
    Qt Code:
    1. QString password = QInputDialog::getText("Hello", "Insert your password", QLineEdit::Password);
    To copy to clipboard, switch view to plain text mode 
    A camel can go 14 days without drink,
    I can't!!!

Similar Threads

  1. How to secure a file by password
    By miraks in forum Qt Programming
    Replies: 8
    Last Post: 22nd March 2011, 19:34
  2. QuaZIP and Password?
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 16th December 2008, 09:10
  3. writing a username and password dialog
    By sergec in forum Qt Programming
    Replies: 5
    Last Post: 25th April 2007, 17:24
  4. Portable Console Password Prompt
    By vermarajeev in forum General Programming
    Replies: 2
    Last Post: 2nd March 2007, 23:29
  5. About Password Protected Files:
    By vermarajeev in forum Qt Programming
    Replies: 7
    Last Post: 16th February 2007, 14:46

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.