SHREERAKSHA BHAT
SHREERAKSHA BHAT

Reputation: 27

Integer type casting in Qml?

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

Answers (1)

Sercan
Sercan

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

Related Questions