Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Password input with others then asterisks
QtWS25 Last Chance

Password input with others then asterisks

Scheduled Pinned Locked Moved QML and Qt Quick
qmlvirtual keyboar5.4.1password
3 Posts 2 Posters 5.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PhTe
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on last edited by
      #2

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

      http://doc.qt.io/qt-5/qml-qtquick-textinput.html#passwordCharacter-prop

      P 1 Reply Last reply
      0
      • L Leonardo

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

        http://doc.qt.io/qt-5/qml-qtquick-textinput.html#passwordCharacter-prop

        P Offline
        P Offline
        PhTe
        wrote on last edited by
        #3

        @Leonardo Yeah, that works. Thank you.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved