Quote Originally Posted by bob_smith View Post
Sure enough that works. The only downside is that now the control is visible when the tests are run, of course. Originally I was hoping to have something that works in the same way as QTest::keyClicks in that the control is never actually visible to whoever is running the test when the keystrokes are entered. However now at least I have something that works, I’ll just have to see if it acceptable for use in our build process.

Thank you for your help.
I know this is an old thread but I am posting this in case anyone else comes across it. I was able to get the focus events working during tests without having to show the widget. I called "QApplication::setActiveWindow(patient_);", where patient is my main widget which holds other widgets in it like line edits etc. After this focus events propagated properply.