Reputation: 117
Suppose the user fill the text-field with the password and the password is in password format ( i.e echoMode: TextField.Password ) so how can user check whether it's correct or not? How can i un-hide the password on click?
TextField {
id: loginPassword
Layout.preferredWidth:app.width*0.8
color:"#ffffff"
font.pixelSize: 14*app.scaleFactor
echoMode: TextField.Password
background: Rectangle {
implicitWidth: 290*app.scaleFactor
implicitHeight: 40*app.scaleFactor
radius: 4*app.scaleFactor
color: "transparent"
border.color: "#ffffff"
height: 37*app.scaleFactor
}
}
Upvotes: 0
Views: 790
Reputation: 8277
You simply need to toggle the echoMode property. You can add a boolean property to control it, if you want.
TextField {
id: loginPassword
property bool showText: false
echoMode: showText ? TextField.Normal : TextField.Password
}
Then when you want to toggle it (like on a mouse press or button click or whatever), just set loginPassword.showText = true
.
Upvotes: 1