Reputation: 27
I was trying to type cast a value from float to int in Qml. How does that work??
text:int(todecimal(score))
For instance score holds 9.8 or 5.3 . I want to make it 9 and 5.
Upvotes: 2
Views: 5914
Reputation: 5091
To convert a text input to integer in QML, use the following method. The following method is used to convert string expression to integer.
text:parseInt(textInput.text)
Try the solution below:
text:parseInt(score)
Upvotes: 1