def METHOD_NAME(self, index: QModelIndex, role=Qt.DisplayRole):
    i, j = index.row(), index.column()
    lbl = self.message_type[i]  # type: SimulatorProtocolLabel
    if role == Qt.DisplayRole:
        if j == 0:
            return lbl.name
        elif j == 1:
            return ProtocolLabel.DISPLAY_FORMATS[lbl.display_format_index]
        elif j == 2:
            if lbl.is_checksum_label:
                return "Checksum"
            else:
                return lbl.VALUE_TYPES[lbl.value_type_index]
        elif j == 3:
            if lbl.value_type_index == 0:
                message = lbl.parent()
                try:
                    METHOD_NAME = message.plain_bits[lbl.start:lbl.end]
                except IndexError:
                    return None
                return util.convert_bits_to_string(METHOD_NAME, lbl.display_format_index, pad_zeros=True)
            elif lbl.value_type_index == 1:
                return "-"
            elif lbl.value_type_index == 2:
                return lbl.formula
            elif lbl.value_type_index == 3:
                return lbl.external_program
            elif lbl.value_type_index == 4:
                return "Range (Decimal): " + str(lbl.random_min) + " - " + str(lbl.random_max)
    elif role == Qt.EditRole:
        if j == 0:
            return lbl.name
        elif j == 1:
            return lbl.display_format_index
        elif j == 2:
            return lbl.value_type_index
        elif j == 3:
            if lbl.value_type_index == 2:
                return lbl.formula
            elif lbl.value_type_index == 3:
                return lbl.external_program
            elif lbl.value_type_index == 4:
                return [lbl.random_min, lbl.random_max]
    elif role == Qt.FontRole:
        if j == 0:
            font = QFont()
            font.setItalic(lbl.field_type is None)
            return font
        elif j == 2 and self.link_index(index):
            font = QFont()
            font.setUnderline(True)
            return font
    elif role == Qt.BackgroundColorRole:
        if j == 0:
            return settings.LABEL_COLORS[lbl.color_index]
        elif j == 3:
            if (lbl.value_type_index == 2 and
                    not self.controller.sim_expression_parser.validate_expression(lbl.formula)[0]):
                return settings.ERROR_BG_COLOR
    elif role == Qt.TextColorRole:
        if self.link_index(index):
            return qApp.palette().link().color()