def METHOD_NAME(parent, text, icon=None, shortcut=None, slot=None):
    action = qt.QAction(text, parent)
    if icon is not None:
        action.setIcon(qt.QIcon.fromTheme(icon))
    if shortcut is not None:
        action.shortcut = qt.QKeySequence.fromString(shortcut)
        action.shortcutContext = qt.Qt.WidgetWithChildrenShortcut
    if slot is not None:
        action.connect('triggered(bool)', slot)
    parent.addAction(action)
    return action