Specifies how the text should be displayed in the TextInput.
\list
\li TextInput.Normal - Displays the text as it is. (Default)
- \li TextInput.Password - Displays asterisks instead of characters.
+ \li TextInput.Password - Displays platform-dependent password mask
+ characters instead of the actual characters.
\li TextInput.NoEcho - Displays nothing.
\li TextInput.PasswordEchoOnEdit - Displays characters as they are entered
- while editing, otherwise displays asterisks.
+ while editing, otherwise identical to \c TextInput.Password.
\endlist
*/
QQuickTextInput::EchoMode QQuickTextInput::echoMode() const
\qmlproperty string QtQuick2::TextInput::passwordCharacter
This is the character displayed when echoMode is set to Password or
- PasswordEchoOnEdit. By default it is an asterisk.
+ PasswordEchoOnEdit. By default it is the password character used by
+ the platform theme.
If this property is set to a string with more than one character,
the first character is used. If the string is empty, the value
, updateType(UpdatePaintNode)
, mouseSelectionMode(QQuickTextInput::SelectCharacters)
, m_layoutDirection(Qt::LayoutDirectionAuto)
- , m_passwordCharacter(QLatin1Char('*'))
+ , m_passwordCharacter(qApp->styleHints()->passwordMaskCharacter())
, focusOnPress(true)
, cursorVisible(false)
, cursorPending(false)
QCOMPARE(initial, QLatin1String("ABCDefgh"));
QCOMPARE(input->echoMode(), QQuickTextInput::Normal);
QCOMPARE(input->displayText(), input->text());
+ const QString passwordMaskCharacter = qApp->styleHints()->passwordMaskCharacter();
//Normal
ref &= ~Qt::ImhHiddenText;
ref &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
input->setEchoMode(QQuickTextInput::NoEcho);
QCOMPARE(input->text(), initial);
QCOMPARE(input->displayText(), QLatin1String(""));
- QCOMPARE(input->passwordCharacter(), QLatin1String("*"));
+ QCOMPARE(input->passwordCharacter(), passwordMaskCharacter);
//NoEcho
ref |= Qt::ImhHiddenText;
ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
ref |= Qt::ImhHiddenText;
ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
QCOMPARE(input->text(), initial);
- QCOMPARE(input->displayText(), QLatin1String("********"));
+ QCOMPARE(input->displayText(), QString(8, passwordMaskCharacter.at(0)));
QCOMPARE((Qt::InputMethodHints) input->inputMethodQuery(Qt::ImHints).toInt(), ref);
// clearing input hints do not clear bits set by echo mode
input->setInputMethodHints(Qt::ImhNone);
QQuickItem *cursor = input->findChild<QQuickItem *>("cursor");
QVERIFY(cursor);
- QChar fillChar = QLatin1Char('*');
+ QChar fillChar = qApp->styleHints()->passwordMaskCharacter();
input->setEchoMode(QQuickTextInput::Password);
QCOMPARE(input->displayText(), QString(8, fillChar));