Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TextField {
- id:textField
- text:"11:11:11"
- width:200
- height:80
- font.pointSize: 15
- color:"white"
- inputMask: "99:99:99"
- validator: RegExpValidator { regExp: /^([0-1s]?[0-9s]|2[0-3s]):([0-5s][0-9s]):([0-5s][0-9s])$ / }
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- inputMethodHints: Qt.ImhDigitsOnly
- }
- TextField {
- ..
- Keys.onBackPressed: text = "00:00:00"
- }
- TextField {
- ..
- Keys.onBackPressed: {
- var index = cursorPosition
- var char = text.charAt(index)
- if(char != ":"){
- text = text.substr(0, index) + "0"+ text.substr(index);
- }
- }
- }
Add Comment
Please, Sign In to add comment