TextInput in qml: How to detect that user has completed typing
-
wrote on 27 Oct 2016, 20:32 last edited by
I am new to Qt & QML. I am using QtQuick 2.4. I have
TextInput
item with a signal defined in aqml
file like below:import QtQuick 2.4 TextInput { text: "Text" cursorVisible: true signal qmlSignal(string msg) }
I also have a slot tied to the
qmlSignal
. I want to trigger the signal when user completes typing on theTextInput
field or closes my qml page to go to another page in the application.What is the correct way to acheive this desired functionality ? I see that there is onEditingFinished(). How can I use onEditingFinished() here ? Can someone pls provide a sample
-
wrote on 27 Oct 2016, 20:46 last edited by
Hi! I guess the
editingFinished
signal is what you're looking for. -
I am new to Qt & QML. I am using QtQuick 2.4. I have
TextInput
item with a signal defined in aqml
file like below:import QtQuick 2.4 TextInput { text: "Text" cursorVisible: true signal qmlSignal(string msg) }
I also have a slot tied to the
qmlSignal
. I want to trigger the signal when user completes typing on theTextInput
field or closes my qml page to go to another page in the application.What is the correct way to acheive this desired functionality ? I see that there is onEditingFinished(). How can I use onEditingFinished() here ? Can someone pls provide a sample
wrote on 28 Oct 2016, 07:08 last edited by Julien BHello @Nelson_Piquet ,
You can use signal handler like this:
TextInput { text: "Text" cursorVisible: true signal qmlSignal(string msg) onEditingFinished: { qmlSignal (text); } onQmlSignal: { console.log(msg) } }
-
Hello @Nelson_Piquet ,
You can use signal handler like this:
TextInput { text: "Text" cursorVisible: true signal qmlSignal(string msg) onEditingFinished: { qmlSignal (text); } onQmlSignal: { console.log(msg) } }
wrote on 28 Oct 2016, 07:23 last edited by@Julien-B thanks a lot
1/4