(self, index, role)
Handling each row data
Handling each row data
Handling each row data
def data(self, index, role):
        """
        Handling each row data
        """

        if not index.isValid():
            return

        # Get selected row
        row_index = index.row()
        data = self._data[row_index]

        # if role == QtCore.Qt.ForegroundRole:  # Make font red
        #     return QtGui.QBrush(QtCore.Qt.red)
        if role == QtCore.Qt.DisplayRole:  # Display name in UI
            return data.name
        if role == QtCore.Qt.UserRole + 1:  # Return ID
            return data.id
        if role == QtCore.Qt.UserRole + 2:  # Return NAME
            return data.name
def data ( self , index , role ) : if not index . isValid ( ) : return # Get selected row row_index = index . row ( ) data = self . _data [ row_index ] # if role == QtCore.Qt.ForegroundRole:  # Make font red #     return QtGui.QBrush(QtCore.Qt.red) if role == QtCore . Qt . DisplayRole : # Display name in UI return data . name if role == QtCore . Qt . UserRole + 1 : # Return ID return data . id if role == QtCore . Qt . UserRole + 2 : # Return NAME return data . name