code: def action2button(action, autoraise=True, text_beside_icon=False, parent=None):
      
      if parent is None:
          parent = action.parent()
      button = QToolButton(parent)
      button.setDefaultAction(action)
      button.setAutoRaise(autoraise)
      if text_beside_icon:
          button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
      return button
docs: Create a QToolButton directly from a QAction object