docs: def add(self, callback=None, name=None, shortcut=None, alias=None,
              docstring=None, menu=None, verbose=True):
          """Add an action with a keyboard shortcut."""
          if callback is None:
              # Allow to use either add(func) or @add or @add(...).
              return partial(self.add, name=name, shortcut=shortcut,
                             alias=alias, menu=menu)
          assert callback
  
          # Get the name from the callback function if needed.
          name = name or callback.__name__
          alias = alias or _alias(name)
          name = name.replace('&', '')
          shortcut = shortcut or self._default_shortcuts.get(name, None)
  
          # Skip existing action.
          if name in self._actions_dict:
              return
  
          # Set the status tip from the function's docstring.
          docstring = docstring or callback.__doc__ or name
          docstring = re.sub(r'[ \t\r\f\v]{2,}', ' ', docstring.strip())
  
          # Create and register the action.
          action = _create_qaction(self.gui, name, callback,
                                   shortcut,
                                   docstring=docstring,
                                   alias=alias,
                                   )
          action_obj = Bunch(qaction=action, name=name, alias=alias,
                             shortcut=shortcut, callback=callback, menu=menu)
          if verbose and not name.startswith('_'):
              logger.log(5, "Add action `%s` (%s).", name,
                         _get_shortcut_string(action.shortcut()))
          self.gui.addAction(action)
          # Add the action to the menu.
          menu = menu or self.menu
          # Do not show private actions in the menu.
          if menu and not name.startswith('_'):
              self.gui.get_menu(menu).addAction(action)
          self._actions_dict[name] = action_obj
          # Register the alias -> name mapping.
          self._aliases[alias] = name
  
          # Set the callback method.
          if callback:
              setattr(self, name, callback)