summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qwidgetlinecontrol_p.h
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-07-25 13:25:15 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-12 13:19:40 +0100
commitd6fb4463b815a0fa21b6f087dc17ca3a45ee56e7 (patch)
tree092d301d7365e9350e7876b1da52baf6a0f29ff6 /src/widgets/widgets/qwidgetlinecontrol_p.h
parent6e0e834e0398192a6da11d1e1bca6b74769fb75d (diff)
Delay masking the last character in Password echo mode.
If QT_GUI_PASSWORD_ECHO_DELAY is defined in qplatformdefs.h with an integer value in milliseconds, QLineEdit and TextInput will display the last character entered unmasked for that delay period and then mask the character as normal. If QT_GUI_PASSWORD_ECHO_DELAY is not defined then the behaviour is unchanged. Task-number: QTBUG-17003 Task-number: QTBUG-20719 Reviewed-by: Martin Jones (cherry picked from commit f9e7aee2019d321edd655bfde7de43f20a106971) Change-Id: If69b384636e3775ad7898b8ffc441011c21abe98 Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Diffstat (limited to 'src/widgets/widgets/qwidgetlinecontrol_p.h')
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index e0c304279e..2e5276e586 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -68,6 +68,8 @@
#include "qplatformdefs.h"
+#include "qplatformdefs.h"
+
QT_BEGIN_HEADER
#ifdef DrawText
@@ -252,6 +254,7 @@ public:
uint echoMode() const { return m_echoMode; }
void setEchoMode(uint mode)
{
+ cancelPasswordEchoTimer();
m_echoMode = mode;
m_passwordEchoEditing = false;
updateDisplayText();
@@ -301,7 +304,13 @@ public:
QString preeditAreaText() const { return m_textLayout.preeditAreaText(); }
void updatePasswordEchoEditing(bool editing);
- bool passwordEchoEditing() const { return m_passwordEchoEditing; }
+ bool passwordEchoEditing() const {
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ if (m_passwordEchoTimer != 0)
+ return true;
+#endif
+ return m_passwordEchoEditing ;
+ }
QChar passwordCharacter() const { return m_passwordCharacter; }
void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); }
@@ -474,6 +483,18 @@ private:
bool m_passwordEchoEditing;
QChar m_passwordCharacter;
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ int m_passwordEchoTimer;
+#endif
+ void cancelPasswordEchoTimer()
+ {
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ if (m_passwordEchoTimer != 0) {
+ killTimer(m_passwordEchoTimer);
+ m_passwordEchoTimer = 0;
+ }
+#endif
+ }
int redoTextLayout() const;
#if defined(Q_WS_MAC)