code: def _createAction(self, widget, iconFileName, text, shortcut, slot):
          
          icon = qutepart.getIcon(iconFileName)
          action = QAction(icon, text, widget)
          action.setShortcut(QKeySequence(shortcut))
          action.setShortcutContext(Qt.WidgetShortcut)
          action.triggered.connect(slot)
  
          widget.addAction(action)
  
          return action
docs: Create QAction with given parameters and add to the widget