Exemplo n.º 1
0
 def data(model, index, role=Qt.DisplayRole):
     """ Returns the data to display """
     if not index.isValid():
         return None
     flags = model.flags(index)
     if role == Qt.TextAlignmentRole:
         return model.get_column_alignment(index.column())
     if role == Qt.BackgroundRole and (flags & Qt.ItemIsEditable
                                       or flags & Qt.ItemIsUserCheckable):
         return QtCore.QVariant(QtGui.QColor(250, 240, 240))
     if role == Qt.DisplayRole or role == Qt.CheckStateRole:
         data = model.get_data(index)
         var = qtype.cast_into_qt(data, role, flags)
         return var
     else:
         return QtCore.QVariant()
Exemplo n.º 2
0
 def headerData(model, section, orientation, role=Qt.DisplayRole):
     """ Qt Override """
     if role == Qt.DisplayRole and orientation == Qt.Horizontal:
         return model.get_niceheader(section)
     else:
         return QtCore.QVariant()