[SOLVED]How to add numbers inside a text element
-
Im trying to add numbers previewed in a text element
@Text {
id: sum1
x: 137
y: 389
width: 80
height: 20
color: "#eadfdf"
text: "1"
font.pixelSize: 12
}Text {
id: sum2
x: 137
y: 389
width: 80
height: 20
color: "#eadfdf"
text: "1"
font.pixelSize: 12
}Text {
id: answer
x: 137
y: 389
width: 80
height: 20
color: "#eadfdf"
text: sum1.text + sum2.text
font.pixelSize: 12
}@It gave me a wrong answer,
How can i use text elements to hold my numbers and add them alltogether? -
Did some research... You can also use Javascript's parseInt method:
@text: parseInt(sum1.text) + parseInt(sum2.text)@