'Insert a new action at the position currently occupied
by `before` (can also be an index).
Parameters
before : :class:`QAction` or int
Position where the `action` should be inserted.
action : :class:`QAction`
Action to insert'

def insertAction(self, before, action):

    if isinstance(before, int):
        actions = list(self.actions())
        if ((len(actions) == 0) or (before >= len(actions))):
            return self.addAction(action)
        before = actions[before]
    return QFrame.insertAction(self, before, action)
