def data(self, index, role):
if not index.isValid():
return None
if not (0 <= index.row() < self.rowCount()):
return None
elif role == Qt.FontRole:
return QtGui.QFont().setPointSize(30)
elif role == Qt.DecorationRole and index.column() == 0:
return None
elif role == Qt.TextAlignmentRole:
return Qt.AlignLeft;
# Color background
if role == Qt.BackgroundRole:
function = self._data[index.row()]
# Row is selected
if index.row() in self.rows_selected:
return FIRST.color_selected
# Data has been updated since original
if function.has_changed:
return FIRST.color_changed
#
if function.id is not None:
return FIRST.color_unchanged
# Return the default color
return FIRST.color_default
if role == Qt.DisplayRole:
function = self._data[index.row()]
column = index.column()
if 0 == column:
return '0x{0:X}'.format(function.address)
elif 1 == column:
return function.name
elif 2 == column:
return function.prototype
elif 3 == column:
return function.comment
return None
return super(FIRST.Model.Upload, self).data(index, role)
评论列表
文章目录