PDA

View Full Version : QLineEdit and focus



serega
16th January 2008, 00:44
I've tried to search a forum, but could not find the answer.
I have a mainwindow with a QLineEdit in the toolbar. I want to brint it to the front, set focus on the application startup, like in Firefox or Konqueror ( No, I am not developing a web browser :) ). Basically I want QLineEdit in the toolbar to be the active widget of the application at startup.
I tried setFocus(), raise(), but it does not help.

grabKeyboard() grabs the keyboard, but it does not make QLineEdit the active widget.

Can anobody help?

Thanks.
serega.

wysota
16th January 2008, 00:49
The widget has to be visible to receive focus, so make sure you set the focus only after show() is called (or even later (for example using a timer), when the window is actually displayed).