I have a QWidget (with a QTextBrowser) that is hidden and shown by an event produced by a global key (keyboard hook).
I want to set the focus to that QTextBrowser after it's shown, and I tried using

Qt Code:
  1. def showEvent(self, e):
  2. self.activateWindow()
  3. self.textBrowser.setFocus()
To copy to clipboard, switch view to plain text mode 

but this wont work. Is there any way I could force the focus (something like yakuake in KDE4) ?

If there is no way doing it, maybe I could use QTest.mouseClick() to make a click on the textBrowser so it will get the focus.