TableModel.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:urh 作者: jopohl 项目源码 文件源码
def data(self, index: QModelIndex, role=Qt.DisplayRole):
        if not index.isValid():
            return None

        i = index.row()
        j = index.column()
        if role == Qt.DisplayRole and self.display_data:
            try:
                if self.proto_view == 0:
                    return self.display_data[i][j]
                elif self.proto_view == 1:
                    return "{0:x}".format(self.display_data[i][j])
                elif self.proto_view == 2:
                    return chr(self.display_data[i][j])
            except IndexError:
                return None

        elif role == Qt.TextAlignmentRole:
            if i in self.first_messages:
                return Qt.AlignHCenter + Qt.AlignBottom
            else:
                return Qt.AlignCenter

        elif role == Qt.BackgroundColorRole:
            return self.background_colors[i, j]

        elif role == Qt.FontRole:
            font = QFont()
            font.setBold(self.bold_fonts[i, j])
            font.setItalic(self.italic_fonts[i, j])
            return font

        elif role == Qt.TextColorRole:
            return self.text_colors[i, j]

        elif role == Qt.ToolTipRole:
            return self.get_tooltip(i, j)
        else:
            return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号