View Full Version : Use QLineEdit as password field

23rd September 2010, 14:58

I need an edit for for password in my login form.
I use QLineEdit class and set echo mode to password, inputHintMethod
- NoAutoUpperCase
- NoPredictiveText

The problem is that:
When application is installed on device N97mini, the first letter is always uppercase automatically and text autocorrection is applied and it makes end-user extremely difficult to enter the correct password when user uses the hard keyboard.

Do you have any ideas how to avoid this problem?
Is it a Qt bug? or N97 mini firmware bug? Anybody experiences this before?


23rd September 2010, 15:51
I've browsed through the qt bugs for a moment and there are a couple of bugs related to the line edit and the N97. But I didn't see your description.

Is at absolutely necessary to use the password masking?

23rd September 2010, 16:03
Hello tbscope,

Because that field is for inputting user's password within a Login form, the text must be hidden/masked. It is mandatory.
Actually, I found that the virtual keyboard of N97 mini works normally while the physical keyboards has problem.


25th October 2010, 10:39
I was upset that the physical keyboard does not work for both N97 mini and N97. I don't have conditions to test on other device and I have to publish application with the uncertainty !
The following is my code.

editPassword = new QLineEdit(this);
editPassword->setInputMethodHints(Qt::ImhHiddenText| Qt::ImhNoPredictiveText|Qt::ImhNoAutoUppercase);

If i remove the second line then my edit field don't have preditivce text. But if I add the second line, my password field is completely useless. The user has to enter password with predictive text !!!!
My customer cannot use the application if he cannot login. My applicaiton is completely useless :(
Any idea how to implement a password field in Qt? This is really a very basic problem, i think !

Thank you in advance


25th October 2010, 19:12
have you thought about something else like maybe a 6x6 grid where he has to select some (6+) items in a row? just a suggestion...
they could be colour coded so he might remember a password as red, red, green, purple, pink, blue, blue

27th October 2010, 14:13
The problem is unrelated to Qt. I'm having the same issue when entering passwords on my N900 in software not written using Qt. What you can surely do is to make passwords case-insensitive.

On the other hand I don't know what is the point of having passwords with predictive text - then you are revealing your password to all applications in the system so what's the point in obscuring the input in the first place?

27th October 2010, 14:20
Hello wysota,

Unfortunately, I cannot make the password case-insenstive because the authentication module was developed long time ago by other group inside my company.
It must be case-sensitive.
Second, my goal is to make the password field is NOT predictive text. I can do that with a normal field. However, when I set
then the predictive text feature is "turned on" and make my application completed useless for user (because most of the case they try to use physical keyboard to input password and they cannot do taht with predictive text is "on").

If this error is not Qt error then Nokia did a very bad error. Most serious application needs authentication and what will happen if user cannot do that with the physical keyboard. Nokia should have fixed this error very long time ago .

I'm going to realease my application an I desperately need a solution for this.


27th October 2010, 14:24
What happens if you remove line #2 from your code or move it after line #3?

27th October 2010, 14:32

If I remove line 2, QLineEdit does not mask the password anymore. All password are displayed when user inputs them
If I swap line 2 and line 3, the result is not changed. QLineEdit still has "predictive text" feature. :(


27th October 2010, 14:53
It seems that Qt hints the firmware it wants to hide the text (as this is what line #3 does) but the hint gets ignored. I don't know if you can overcome this problem without subclassing QLineEdit. You can try using style-sheets instead of line #2 to ask the widget to use a different echo character but I don't know if it will work without setting the widget to password mode.