summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qlineedit.cpp
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-04-20 14:07:02 (GMT)
committeraxis <qt-info@nokia.com>2009-05-04 13:24:47 (GMT)
commit203b2b2c611e29ee18ee4f546b8695359710fd1b (patch)
treee80676be235d036f428c876b07a8bdbb0eb47269 /src/gui/widgets/qlineedit.cpp
parentce4faedea2b652c1d7fc5430bbd906972a3c93bf (diff)
downloadQt-203b2b2c611e29ee18ee4f546b8695359710fd1b.zip
Qt-203b2b2c611e29ee18ee4f546b8695359710fd1b.tar.gz
Qt-203b2b2c611e29ee18ee4f546b8695359710fd1b.tar.bz2
Made QLineEdit set input method hints when changing echo mode.
RevBy: denis
Diffstat (limited to 'src/gui/widgets/qlineedit.cpp')
-rw-r--r--src/gui/widgets/qlineedit.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index d03cd3e..fa337af 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -97,8 +97,7 @@ extern void qt_mac_secure_keyboard(bool); //qapplication_mac.cpp
static inline bool shouldEnableInputMethod(QLineEdit *lineedit)
{
- const QLineEdit::EchoMode mode = lineedit->echoMode();
- return !lineedit->isReadOnly() && (mode == QLineEdit::Normal || mode == QLineEdit::PasswordEchoOnEdit);
+ return !lineedit->isReadOnly();
}
/*!
@@ -544,7 +543,13 @@ void QLineEdit::setEchoMode(EchoMode mode)
Q_D(QLineEdit);
if (mode == (EchoMode)d->echoMode)
return;
- setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this));
+ Qt::InputMethodHints imHints = inputMethodHints();
+ if (mode == Password) {
+ imHints |= Qt::ImhHiddenText;
+ } else {
+ imHints &= ~Qt::ImhHiddenText;
+ }
+ setInputMethodHints(imHints);
d->echoMode = mode;
d->passwordEchoEditing = false;
d->updateTextLayout();