PDA

View Full Version : setFocus after hide and show qwidget



alexandernst
14th April 2010, 17:25
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



def showEvent(self, e):
self.activateWindow()
self.textBrowser.setFocus()


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.