app.py 文件源码

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

项目:FuME 作者: fupadev 项目源码 文件源码
def data(self, item, role):
        # Changing color if "reserved" is True
        if role == QtCore.Qt.BackgroundRole:
            if item.row() % 2: # alternating background color
                # dark
                if QtSql.QSqlQueryModel.data(self, self.index(item.row(), 7), QtCore.Qt.DisplayRole) == 1:
                    return QtGui.QBrush(QtGui.QColor.fromRgb(176, 234, 153))
                if QtSql.QSqlQueryModel.data(self, self.index(item.row(), 7), QtCore.Qt.DisplayRole) == 2:
                    return QtGui.QBrush(QtGui.QColor.fromRgb(234, 189, 190))
            else:
                # light
                if QtSql.QSqlQueryModel.data(self, self.index(item.row(), 7), QtCore.Qt.DisplayRole) == 1:
                    return QtGui.QBrush(QtGui.QColor.fromRgb(198, 247, 178))
                if QtSql.QSqlQueryModel.data(self, self.index(item.row(), 7), QtCore.Qt.DisplayRole) == 2:
                    return QtGui.QBrush(QtGui.QColor.fromRgb(250, 217, 218))

        return QtSql.QSqlQueryModel.data(self, item, role)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号