QWidget Focus Only

Hello ,i have a question ,How can you keep the Focus on a Qwidget when the input is not valid and until it is valid you can select another Qwidget?