Important: Please read the Qt Code of Conduct -

QLineEdit selected when QDialog open

  • I use Qt Designer to create a dialog for my application. The dialog consist in a few line edit, label and button.

    When the dialog open the 4th line edit is automatically selected. However I want the 1st line edit to be selected. How can I achieve that?

    I thought of a slot that setFocus when the dialog open signal is triggered or a QLineEdit property but I haven't found the information in the ressource database.

    Thank you

  • Setting the tab order in the dialog so that the desired QLineEdit is the first item set should work.

    This also allows you to define the order so that when you tab through the different controls they progress in a logical order.

  • I already did it. I still have the same problem

  • Still, that is how it works. If you still get the same issue, then I guess your changes were not applied correctly.

    Note that you can of course force the focus.

Log in to reply