Can't use TextInput.onTextEdited!
Moved
Unsolved
QML and Qt Quick
-
I'm trying to use the signal onTextEdited in my TextInput, but Qt keeps telling me that ' "TextInput.onTextEdited" is not available in QtQuick 2.7 ' for some reason. But according to the docs, it was introduced in 2.7! What is going on? I'm also running Qt 5.9, so that shouldn't be a problem either.
What I'm trying to do, is replacing the text everytime you write. For an example, I want to format the string "122" to a string "12/2" automatically, but it won't work for some reason. :/
function formatDateString(text) { var newString = text.match(/.{1,2}/g); return newString.length > 1 ? newString.join("/") : newString[0]; }
The function I'm trying to use.
TextInput { onTextChanged: { text = showSearchArea.formatDateString(text) } }
What I tried doing, but obviously it didn't work.