code: def data(self, index, role=QtCore.Qt.UserRole):
          
          if role == QtCore.Qt.DisplayRole:
              row = index.row()
              field = self._headers[index.column()]
              val = self.model.paramValue(row, field)
              if 1 <= index.column() <= 3:
                  # standard units for data, not necessary current for UI
                  # view will scale and convert appropriately
                  unit = self.model.getDetail(index.row(), 'unit')
                  if val is not None and unit is not None:
                      return str(val) + ' ' + unit
                  else:
                      return val
              else:
                  return val
  
          elif role == QtCore.Qt.EditRole:
              row = index.row()
              field = self._headers[index.column()]
              return self.model.paramValue(row, field)
              # return self.model.paramValue(row, field)
          elif role == QtCore.Qt.ForegroundRole:
              # color the background red for bad values
              if not self.checkValidCell(index):
                  return QtGui.QBrush(ERRCELL)
          elif role == QtCore.Qt.FontRole:
              # color the background red for bad values
              if not self.checkValidCell(index):
                  f = QtGui.QFont()
                  f.setWeight(QtGui.QFont.Bold)
                  return f
  
          elif role == QtCore.Qt.UserRole or role == AbstractDragView.DragRole:  #return the whole python object
              param = self.model.param(index.row())
              for comp in param['selection']:
                  comp.clean()
              return param
  
          elif role == self.SelectionModelRole:
              # may need to translate to QModelIndexes
              return self.model.selection(self.model.param(index.row()))
          
          elif role == CursorRole:
              col = index.column()
              if not index.isValid():
                  return QtGui.QCursor(QtCore.Qt.ArrowCursor)
              elif col == 0:
                  return cursors.pointyHand()
              elif col < 4:
                  return cursors.handEdit()
              else:
                  return cursors.openHand()
docs: Used by the view to determine data to present
  
          See :qtdoc:`QAbstractItemModel<QAbstractItemModel.data>`, 
          and :qtdoc:`subclassing<qabstractitemmodel.subclassing>`