How to move the cursor point from one Textfield to another Textfield?
-
I have 6 text fields as shown below:
When i am entering a number as input in 1st text field, it should jump to next i.e. 2nd text field automatically after entering a single input in the 1st text field. How this can be done?
As of now now its taking tab for moving to the next text field.
I want this to happen automatically. -
This has nothing special to do with mobile or embedded systems, so you are posting on a wrong forum.
(You need to write a handler where you bet signal textEdited() from a field, check cursorPosition() and length of field and then set focus to the next field.) -
@JasmineSethi You can add nextTextField.focus = true in onChanged signal in each text field as below
TextField{ id: txtfld onTextChanged: { txtfld1.focus = true } } TextField{ id: txtfld1 }
check textfield length before change the focus to next field.
-
@Tirupathi-Korla Yeah this solved my problem. Thanks a lot
-
@JasmineSethi What if i want to delete the password from right to left without going into each indivisual text field manually? It should jump backward automatically when deleted.
-
@JasmineSethi try checking with textfield length == 0 in ontextchanged and move to previous text field.
-
My aim is not only to move the cursor position backward but also to delete.
@Tirupathi-Korla above stated solution is not fixing my problem. InfactTextField.length === 0
is making more than one entry in the text field which i dont want. I want to delete from Textfield 6 to Textfield 1 in backward direction one after the another and then re - enter the password again.
-
@JasmineSethi add below code.
Keys.onPressed: {
if(currentField1.text.length == 0 && event.key == 16777219){
prevField.text = ""
prevField.focus = 1
}
} -
@Tirupathi-Korla Thanks a lot. This solved my problem. But why you used event.key == 16777219?
Also, when i am testing my code in android device, i am getting UI as below;
Why this cursor symbol is visible in each text field even after jumping to next Textfield?
In some other android devices its working fine. Cursor symbol is not visible after each input.
For Desktop also its working fine.
Why this is happening? -
@JasmineSethi said in How to move the cursor point from one Textfield to another Textfield?:
16777219
Its an enum value of Qt.Key_Backspace. you can replace number with "Qt.Key_Backspace"
Can you change the focus to false once you leave the text field. Maybe because of it, it is showing the cursor.
-
This post is deleted!