I have a Qlineedit
widget which i will use to accept the username. It will be displayed as soon as user launch the application. I want the Qlineedit
widget ready for typing (ie, with cursor already in place) without needing the user to use mouse to click on the widget before typing.
I have tried .setFocus()
and .setCursorPosition(1)
but doesn't seem to work.
Which method should i use to set the cursor at the starting position of Qlineedit
without user needing to click on it?
It was my mistake. I was trying to use setFocus
before i add the widget to the layout.
Now, I used the setFocus
method after the wiget is added to the layout and it works fine.