View Single Post
Posts: 263 | Thanked: 679 times | Joined on Apr 2008 @ Lyon, France
#2
See http://bugreports.qt.nokia.com/browse/QTBUG-7679

"A QLineEdit with echoMode set to QLineEdit::Password does still capitalize the first character that is entered. Additiionally, the user has no way of realizing this since the entered characters are not shown briefly before being replaced with *."

(I notice that you don't set echo mode to Password yet, but this seems related)

The QLineEdit API docs here: http://doc.trolltech.com/4.5/qlineedit.html

They don't mention capitalization of initials.

Looking through the docs of related classes doesn't mention it either.

And there's a good reason, because when I try the "lineedit" example from the Qt sources on my desktop, no capital!!! It's a Maemo specific thing.

http://wiki.maemo.org/Qt (formerly qt4.garage.maemo.org) and http://wiki.maemo.org/Qt4Hildon#Over..._Maemo_changes might give some more hints on getting rid of capitalization for a Qt input field - there's a property you need to set for a Hildon text entry.

In fact, unless I'm mistaken, the answer is right there in that last page, in the "Input method" box:

Input Method:
Maemo Qt uses the Hildon IM as default Input method.
Each kind of widget can set the IM mode. This allows the input method to focus on the type of input that the application is expecting.

...snip...

A developer can change it by using:
void QInputContext::setInputMode(int mode);

...snip...

HILDON_GTK_INPUT_MODE_AUTOCAP automatically capitalize the first letter at the start of a sentence.

...snip...

Example:
For a password field we need to set a specific IM mode:
int mode = HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE
QInputContext *qic = widget->inputContext();
qic->setInputMode(mode);

So in your case:
QLineEdit widget = new QLineEdit();
int mode = HILDON_GTK_INPUT_MODE_FULL;
QInputContext *qic = widget->inputContext();
qic->setInputMode(mode);
widget.setEchoMode(QLineEdit::Password);

And I hope that setting echomode doesn't reset setting the input context...

Let me know if this works, I'l not at all certain of myself

Dave.
widget.set