def data(self, index, role=QtCore.Qt.DisplayRole): """Get item data. :param index: THe index to get the data for. :type index: QtCore.QModelIndex :param role: The role to get the data for. :type role: int :return: The item data. :rtype: object """ if not index.isValid(): return None row = index.row() column = index.column() if role == QtCore.Qt.DisplayRole: item = self.items[row] if column == 0: return item.name if column == 1: return item.description elif column == 2: return item.author elif column == 3: if item.date is not None: return utils.date_to_string(item.date) return None
def data(self, index, role=QtCore.Qt.DisplayRole): """Get item data.""" if not index.isValid(): return None row = index.row() column = index.column() if role == QtCore.Qt.DisplayRole: item = self.items[row] if column == 0: return item.name if column == 1: return item.description elif column == 2: return item.author elif column == 3: if item.date is not None: return utils.date_to_string(item.date) return None
def data(self, index, role=QtCore.Qt.DisplayRole): """Get item data.""" if not index.isValid(): return row = index.row() column = index.column() if role == QtCore.Qt.DisplayRole: item = self.items[row] if column == 0: return item.name if column == 1: return item.description elif column == 2: return item.author elif column == 3: if item.date is not None: return utils.date_to_string(item.date)