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

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
create a qtoolbutton directly from a qaction object .