[Solved] TextInput: font color change when text changes
QML and Qt Quick
6
Posts
4
Posters
6.2k
Views
2
Watching
-
Hello.
There is nothing like
onChangefor theTextInputbut onlyonDisplayDataChangedwhat didn't work for me.TextInput { id: text_input1 width: 80 height: 20 text: qsTr("234234") font.pixelSize: 12 inputMethodHints: Qt.ImhFormattedNumbersOnly on???: { text_input1.color = "#333333" }}And how can I set the same effect for different events, I want to call the same function when on?1 or on?2 or on?3 is called.
something like on?1,on?2,...,.., : { text_input1.color = "#333333" }but didnt work
Thank you ;)
-
For every property in QML there is signal
on<PropertyName>Changed. So you needonTextChanged.For your second question: No. You should write signal handling one by one.
-
Ok, thank you ;)
-
@task_struct said in [Solved] TextInput: font color change when text changes:
So you need onTextChanged.