def METHOD_NAME(self, index):
    self._doc.clear()
    cursor = QTextCursor(self._doc)
    cursor.setCharFormat(self._device_format)
    port_info = index.data(Qt.UserRole)
    if port_info is None:
        cursor.insertText(index.data(Qt.DisplayRole))
        return
    cursor.insertText(port_info.device)
    details = serial_port_details(port_info)
    if not details:
        return
    cursor.insertFrame(self._details_frame_format)
    details_list = cursor.createList(self._details_list_format)
    for n, part in enumerate(details):
        if n:
            cursor.insertBlock()
        cursor.insertText(part, self._details_char_format)