def actionEvent(self, event): QToolBar.actionEvent(self, event) if event.type() == QEvent.ActionAdded or \ event.type() == QEvent.ActionRemoved: self.__layout(self.size())