docs: def undo(self):
          """
          Undo the last command by adding its inverse action to the stack.
  
          This method automatically takes care of applying the correct
          inverse action when it is called consecutively (ie. without a
          calling ``push`` in between).
  
          The ``qtesigSavedState`` signal is triggered whenever enough undo
          operations have been performed to put the document back into the
          last saved state.
  
          ..warning: The ``qtesigSaveState`` is triggered whenever the
            logic of the undo operations **should** have led back to
            that state, but since the ``UndoStack`` only stacks and
            ``QtmacsUndoCommand`` objects it may well be the document is
            **not** in the last saved state, eg. because not all
            modifications were protected by undo objects, or because the
            ``QtmacsUndoCommand`` objects have a bug. It is therefore
            advisable to check in the calling class if the content is
            indeed identical by comparing it with a temporarily stored
            copy.
  
          |Args|
  
          * **None**
  
          |Signals|
  
          * ``qtesigSavedState``: the document is the last saved state.
  
          |Returns|
  
          * **None**
  
          |Raises|
  
          * **None**
          """
          # If it is the first call to this method after a ``push`` then
          # reset ``qteIndex`` to the last element, otherwise just
          # decrease it.
          if not self._wasUndo:
              self._qteIndex = len(self._qteStack)
          else:
              self._qteIndex -= 1
  
          # Flag that the last action was an `undo` operation.
          self._wasUndo = True
          if self._qteIndex <= 0:
              return
  
          # Make a copy of the command and push it to the stack.
          undoObj = self._qteStack[self._qteIndex - 1]
          undoObj = QtmacsUndoCommand(undoObj)
          self._push(undoObj)
  
          # If the just pushed undo object restored the last saved state
          # then trigger the ``qtesigSavedState`` signal and set the
          # _qteLastSaveUndoIndex variable again. This is necessary
          # because an undo command will not *remove* any elements from
          # the undo stack but *add* the inverse operation to the
          # stack. Therefore, when enough undo operations have been
          # performed to reach the last saved state that means that the
          # last addition to the stack is now implicitly the new last
          # save point.
          if (self._qteIndex - 1) == self._qteLastSavedUndoIndex:
              self.qtesigSavedState.emit(QtmacsMessage())
              self.saveState()