Unsolved How to move the cursor automatically from one qlineedit to another?
-
Hi,
I have 3 line edits to accept a phone number. The area code is 3 digits. How can I get the mouse cursor to move automatically to the next line edit as soon as 3 digits are entered?
-
Hi @WhatIf,
Set the first line edit (for area code) max length to 3.
Then, set your application's tab order.
Then, set focus to the next line edit. -
I already have the first 2 steps in place. But how do I set focus to the next line edit?
I know I will use setFocus() but what is the logic? Is it going to be done using signal/slot?
-
@WhatIf Yes, you can use signals/slots for that. Connect http://doc.qt.io/qt-5/qlineedit.html#textChanged signal from your 3 digits line edit to a slot and in this slot call setFocus() from the other line edit when the first line edit contains 3 digits.