Ich arbeite in Qml, ich habe ein Textfeld für Passwort und ein Textfeld für die Bestätigung Passwort, während Benutzer eingeben Passwort bestätigen, sollten die Zeichen kontinuierlich übereinstimmen und Textfeld Farbe sollte sich ändern, wenn das Passwort übereinstimmt oder fehlschlägt.Match-Passwort und bestätigen Sie das Passwort in der Laufzeit in qm
-4
A
Antwort
-1
Es ist ziemlich einfach. Sie müssen nur die text
Eigenschaften von Textfeldern überprüfen.
import QtQuick 2.7
import QtQuick.Controls 1.4
Grid {
id: rtfm
columns: 2
rows: 3
spacing: 5
// Password stuff
Label {
id: password_label
text: qsTr("Password")
}
TextField {
id: password_field
placeholderText: qsTr("Write your password")
echoMode: TextInput.Password
}
// Confirm password stuff
Label {
id: confirm_password_label
text: qsTr("Confirm password")
}
TextField {
id: confirm_field
placeholderText: qsTr("Confirm the password")
echoMode: TextInput.Password
// Called each time the user types in the confirm password text field.
onTextChanged: {
// Checks whether the password and its confirmation are the same.
if (password_field.text === confirm_field.text) {
text_color_box.text = qsTr("Password and confirm password match.");
text_color_box.color = "#00ff00";
}
else {
text_color_box.text = qsTr("Password and confirm password do not match.");
text_color_box.color = "#ff0000";
}
}
}
// Your text color box
Text {
id: text_color_box
text: qsTr("Let's match password and confirm password.")
}
}
+0
Warum geben Sie eine -1? –
0
Hier Probe Beispiel
Kennwort bestätigen rot gefärbt ist, bestätigen Passwort, um anzuzeigen, ist nicht das eingegebene Passwort passende
Text {
id: enterpassword
text: "Enter Password"
}
Rectangle {
id: rectpassword
width: 300
height: 50
anchors.top: enterpassword.bottom
anchors.topMargin: 10
border.width: 1
border.color: "#c0c0c0"
TextInput {
id: password
anchors.fill: parent
echoMode: TextInput.Password
}
}
Text {
id: confirmtext
anchors.top: rectpassword.bottom
anchors.topMargin: 10
text: "Confirm Password"
}
Rectangle {
id: confirmpassword
width: 300
height: 50
anchors.top: confirmtext.bottom
anchors.topMargin: 10
border.width: 1
border.color: confirmPassword.text === password.text ? "#c0c0c0" :"red"
TextInput {
id: confirmPassword
anchors.fill: parent
echoMode: TextInput.Password
}
}
Verwandte Themen
- 1. Bestätigen Sie das Passwort mit bestätigen Passwort während der Anmeldung in PHP
- 2. Bestätigen Sie NT-Benutzername + Passwort in ASP.NET
- 3. Validate Passwort ein und bestätigen Passwort Ng2
- 4. Passwort bestätigen?
- 5. Passwort und bestätigen Passwort Validierung in Javascript Fehler?
- 6. So speichern Sie die Änderungen, indem Sie das Passwort bestätigen
- 7. Bestätigen Sie in bestätigen
- 8. Authlogic: Login/Passwort bestätigen
- 9. "Passwort bestätigen" und "Passwort" stimmen nicht überein. MVC5
- 10. Rails 4 + Devise: Passwort bestätigen
- 11. Parsley.js Passwort bestätigen funktioniert nicht
- 12. ASP: NET Passwort bestätigen Feld
- 13. PassportJS Vergleichen Passwort bestätigen Feld
- 14. qmake und generierte qm-Dateien
- 15. Swift: Passwort kann nicht bestätigen
- 16. Bestätigen Sie das Feld "Jeditable"
- 17. kann Passwort in mysql db nicht aktualisieren und wie bestätigen Passwort in Registerseite
- 18. Wie validiere ich das Passwort und bestätige das Passwort in Accelerated Mobile Pages (AMP)?
- 19. So bestätigen Sie eine Aktion ohne bestätigen() in Pop-in
- 20. "Bitte bestätigen Sie den Benutzer, für den Sie das Passwort ändern"
- 21. Versuchen, bestätigen Passwort mit Firebase Auth
- 22. Bestätigen Sie einen gesalzenen Hash
- 23. Kann nicht bestätigen Passwort Validierung mit jquery
- 24. Speichern Sie das verschlüsselte Passwort in xml
- 25. ng-pattern um Passwort zu bestätigen
- 26. Bestätigen Sie die Passwort-Validierung mit Material Design Lite Fehlern
- 27. Bestätigen Sie das Textfeld mit einem Sonderzeichen
- 28. Toast Meldung, obwohl Kennwort erscheinen und bestätigen Passwort Match
- 29. update_attribute ändert das Passwort in Rails
- 30. Passwort ist falsch hält erscheinen, obwohl Benutzername und das Passwort korrekt sind und in der Datenbank
was ist Ihre Frage? und was hast du bisher gemacht? – Hayt