code: def setup_context_menu(self):
          
          self.menu = QMenu(self)
          self.cut_action = create_action(self, _("Cut"),
                                          shortcut=keybinding('Cut'),
                                          icon=ima.icon('editcut'),
                                          triggered=self.cut)
          self.copy_action = create_action(self, _("Copy"),
                                           shortcut=keybinding('Copy'),
                                           icon=ima.icon('editcopy'),
                                           triggered=self.copy)
          paste_action = create_action(self, _("Paste"),
                                       shortcut=keybinding('Paste'),
                                       icon=ima.icon('editpaste'),
                                       triggered=self.paste)
          save_action = create_action(self, _("Save history log..."),
                                      icon=ima.icon('filesave'),
                                      tip=_("Save current history log (i.e. all "
                                            "inputs and outputs) in a text file"),
                                      triggered=self.save_historylog)
          self.delete_action = create_action(self, _("Delete"),
                                      shortcut=keybinding('Delete'),
                                      icon=ima.icon('editdelete'),
                                      triggered=self.delete)
          selectall_action = create_action(self, _("Select All"),
                                      shortcut=keybinding('SelectAll'),
                                      icon=ima.icon('selectall'),
                                      triggered=self.selectAll)
          add_actions(self.menu, (self.cut_action, self.copy_action,
                                  paste_action, self.delete_action, None,
                                  selectall_action, None, save_action) )
docs: Setup shell context menu