Skip to content

Commit

Permalink
Use Qt::ImhSensitiveData input hint on TextInput with password echo mode
Browse files Browse the repository at this point in the history
Change-Id: I1e9255af24b51ca42c1e6df7a92664be532ce725
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
  • Loading branch information
Pekka Vuorela authored and Qt by Nokia committed Jan 3, 2012
1 parent 9b571bd commit f9a574a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/quick/items/qquicktextinput.cpp
Expand Up @@ -952,7 +952,7 @@ void QQuickTextInputPrivate::updateInputMethodHints()
else if (m_echoMode == QQuickTextInput::PasswordEchoOnEdit)
hints &= ~Qt::ImhHiddenText;
if (m_echoMode != QQuickTextInput::Normal)
hints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
hints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
q->setInputMethodHints(hints);
}
/*!
Expand Down
8 changes: 4 additions & 4 deletions tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp
Expand Up @@ -2178,20 +2178,20 @@ void tst_qquicktextinput::echoMode()
QCOMPARE(input->displayText(), input->text());
//Normal
ref &= ~Qt::ImhHiddenText;
ref &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
ref &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
QCOMPARE(input->inputMethodHints(), ref);
input->setEchoMode(QQuickTextInput::NoEcho);
QCOMPARE(input->text(), initial);
QCOMPARE(input->displayText(), QLatin1String(""));
QCOMPARE(input->passwordCharacter(), QLatin1String("*"));
//NoEcho
ref |= Qt::ImhHiddenText;
ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
QCOMPARE(input->inputMethodHints(), ref);
input->setEchoMode(QQuickTextInput::Password);
//Password
ref |= Qt::ImhHiddenText;
ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
QCOMPARE(input->text(), initial);
QCOMPARE(input->displayText(), QLatin1String("********"));
QCOMPARE(input->inputMethodHints(), ref);
Expand All @@ -2202,7 +2202,7 @@ void tst_qquicktextinput::echoMode()
input->setEchoMode(QQuickTextInput::PasswordEchoOnEdit);
//PasswordEchoOnEdit
ref &= ~Qt::ImhHiddenText;
ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
QCOMPARE(input->inputMethodHints(), ref);
QCOMPARE(input->text(), initial);
QCOMPARE(input->displayText(), QLatin1String("QQQQQQQQ"));
Expand Down

0 comments on commit f9a574a

Please sign in to comment.