def mousePressEvent(self, event): mainWindowDockWidget.setAsCurrent(self) return QDockWidget.mousePressEvent(self, event)