Solved How to set text again in Text::onTextChanged
-
I am using Text component as label. And programatically I set text to 'Text component'.
But, I would like to check input and set what I want again. For instance, take care of decimal point and unit by my customization.I tried this. But it didn't work even though I succeed updating of 'text' property.
onTextChanged: {
text = "my new changes'
console.log("onTextChanged" + text)
}Could you help me this?
-
Hi @Jehyeok and Welcome,
onTextChanged
signal handler returns a copy of the changed text which is what your are try to modify and hence it doesn't affect the text ofText
component.
To make it work just set text usingid
ofText
component.
For eg:onTextChanged: { myText.text = "my new changes" // myText = id of Text component }
-
@p3c0 Thansk it works :)