code: def setup_menu(self):
          
          self.copy_action = create_action(self, _('Copy'),
                                           shortcut=keybinding('Copy'),
                                           icon=ima.icon('editcopy'),
                                           triggered=self.copy,
                                           context=Qt.WidgetShortcut)
          menu = QMenu(self)
          add_actions(menu, [self.copy_action, ])
          return menu
docs: Setup context menu