PDA

View Full Version : Format showed input text in TextField



bananahana
19th November 2019, 10:43
I am trying to format the user input text in a TextField, for example to show a comma/dot for numbers greater than 1000. So when typing 1000 -> 1.000 should be shown in the TextField.
I tried something like



TextField {
id: textField
//my wanted presentation of the text is something like: text: Number(textField.text).toLocaleString(Qt.locale("en_US"), 'f', 1) ....
}


However, as you can guess, this is causing a binding loop. I look over all properties of TextField but I cannot find any usable for this case. InputMask and Validator sounded similiar but I think this is not exactly what I need.
Does someone know what I have to look at to achieve this?