def event(self, event): if event.type() == QEvent.WindowActivate: self.activated.emit() return QMainWindow.event(self, event)