Can't use TextInput.onTextEdited!
Moved
Unsolved
QML and Qt Quick
-
wrote on 15 Sept 2017, 11:57 last edited by
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.
-
wrote on 15 Sept 2017, 11:59 last edited by
@Marek said in Getting text from TextFiled before "OK" on keyboard is clicked:
need to import QtQuick 2.9 not 2.7
1/2