PDA

View Full Version : How to set focus on control



sq_vasya
8th November 2010, 15:53
I have a class derived from QVBoxLayout and it has several controls derived from QWidget. When I press cursor arrows focus switches from control to control correctly. But when I try to set focus with QWidget::setFocus() nothing happens. Focus stays on previous control. Question is how to set focus on needed control grammatically?
Thanks.

high_flyer
8th November 2010, 16:40
Can you show some relevant code?

sq_vasya
8th November 2010, 17:23
Unfortunately no... It's a huge project that I need to fix and now I am trying to understand how it works.

high_flyer
8th November 2010, 20:06
Try setting the focus on the first widget BEFORE you show the window in which the widgets are in.
See if setFocus() works then.