code: def set_cursor_position(self, position):
          
          position = self.get_position(position)
          cursor = self.textCursor()
          cursor.setPosition(position)
          self.setTextCursor(cursor)
          self.ensureCursorVisible()
docs: Set cursor position