TextInput focus issue
-
I have big project with 100s of qml files. In one of the qml files we are using TextInput. TextInput gets focus only if I click.
Just a sample code.
Rectangle { TextInput{} }
- We are setting the focus. Does not work
- We tried using FocusScope. Did not work
- We tried using forceActiveFocus(..). Did not work.
When we look at the activeFocus property, it gives me 'true'. But cursor does not come. I will not be able to enter text.
If I click on the Rectangle or inside the TextInput, it immediately gets the focus. Otherwise it never.
Any inputs on findout who is holding the focus ? Why it is not transferring the focus ?
-
I have big project with 100s of qml files. In one of the qml files we are using TextInput. TextInput gets focus only if I click.
Just a sample code.
Rectangle { TextInput{} }
- We are setting the focus. Does not work
- We tried using FocusScope. Did not work
- We tried using forceActiveFocus(..). Did not work.
When we look at the activeFocus property, it gives me 'true'. But cursor does not come. I will not be able to enter text.
If I click on the Rectangle or inside the TextInput, it immediately gets the focus. Otherwise it never.
Any inputs on findout who is holding the focus ? Why it is not transferring the focus ?
Hi,
@dheerendra said in TextInput focus issue:We are setting the focus. Does not work
I had similar problem, because was trying to set the focus too early,
I just delayed thatComponent.onCompleted{ myTxtInputId.focus = true }
instead of
TextInput{ id: myTxtInputId focus:true }
-
Thanks @LeLev. I appreciate your response. I will try & let you know the result.