diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-08-17 02:52:09 (GMT) |
---|---|---|
committer | Timo Turunen <timo.p.turunen@nokia.com> | 2011-08-30 07:02:14 (GMT) |
commit | b7f1dc2da720ba371b7f46f168ea271f0372c7f6 (patch) | |
tree | 419c0ca86b077c0f05ed4a393e6701b92489f1cd /src | |
parent | 11510d003d7eb7838183039d751d76dca6851a68 (diff) | |
download | Qt-b7f1dc2da720ba371b7f46f168ea271f0372c7f6.zip Qt-b7f1dc2da720ba371b7f46f168ea271f0372c7f6.tar.gz Qt-b7f1dc2da720ba371b7f46f168ea271f0372c7f6.tar.bz2 |
Fix delayed password masking mid-string.
Unmask the last character typed, not the last character in the string.
Change-Id: I9c70d2347bf878c18ab0a7f4ea76f755ca19a85c
Task-number: QTBUG-17003
Reviewed-by: Alan Alpert
(cherry picked from commit b98e9e69dd8ba33d5f01b9518d95b63b86c4b443)
Reapplied after bad v4.7.4 merge
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index a879b49..198bc04 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE #ifdef QT_GUI_PASSWORD_ECHO_DELAY -static int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY; +static const int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY; #endif /*! @@ -93,8 +93,8 @@ void QLineControl::updateDisplayText(bool forceUpdate) if (m_echoMode == QLineEdit::Password) { str.fill(m_passwordCharacter); #ifdef QT_GUI_PASSWORD_ECHO_DELAY - if (m_passwordEchoTimer != 0 && !str.isEmpty()) { - int cursor = m_text.length() - 1; + if (m_passwordEchoTimer != 0 && m_cursor > 0 && m_cursor <= m_text.length()) { + int cursor = m_cursor - 1; QChar uc = m_text.at(cursor); str[cursor] = uc; if (cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { |