ItemViews_QListView_01_user_list_model.py 文件源码

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

项目:OpenTutorials_PyQt 作者: RavenKyu 项目源码 文件源码
def data(self, QModelIndex, role=None):
        item = self._data[QModelIndex.row()]

        if role == Qt.DisplayRole:
            return "%s" % (item['name'])
        elif role == Qt.DecorationRole:
            return QColor(item['color'])
        elif role == Qt.BackgroundRole:
            return QBrush(Qt.Dense7Pattern)
        elif role == Qt.ToolTipRole:
            return "Tool Tip: %s" % (item['name'])
        return QVariant()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号