Important: Please read the Qt Code of Conduct -

Password input with others then asterisks

  • I have created a TextField which acts as a password input field

    TextField {
        id: passwordInput
        echoMode: TextInput.Password
        style: TextFieldStyle {
            background: Rectangle {
                radius: 6
                border.color: "#AAA"

    This works so far, except that the font i use seems not compatible with password fields and it shows only small boxes instead of asterisks which looks very ugly.

    So is it possible to show other characters instead of *, for example a # or an X or something like this?

    My first try was to handle the keys.onpressed event and set the characters in the text field manually, but i use a virtual keyboard and there is a bug (QTBUG-40803) which prevent qt from receiving key events from virtual keyboards in text inputs. So this does not work...

    Does anyone know a solution for this?

  • Try using a TextInput instead. Then you can set the passwordCharacter property.

  • @Leonardo Yeah, that works. Thank you.