There is an interface in which the table is drawn as QTableView. In api, associated with the program, there is some data that is loaded and form a certain number of columns, rows, and so on in the program itself. Tell me, please, how can I make changes to the table cells, because I cannot just “click”, as in the case of a table with fields that were originally drawn and other things, I cannot, that is, the program simply does not allow me to do this.
Thanks for attention!
upd: Here is the class that forms the table, here I need a function that allows you to make changes to the cells. (tasks loaded from another class, there requests and so on):
class TableModel(QAbstractTableModel): def __init__(self, parent=None): super(TableModel, self).__init__(parent) self.tasks = [] def rowCount(self, parent=None, *args, **kwargs): return len(self.tasks) def columnCount(self, parent=None, *args, **kwargs): return 7 def data(self, index, role=None): if role == Qt.DisplayRole: row = index.row() column = index.column() if column == 0: return self.tasks[row].title elif column == 1: return self.tasks[row].start_date.toString() elif column == 2: return self.tasks[row].end_date.toString() elif column == 3: return self.tasks[row].man_hours elif column == 4: return self.tasks[row].task_type elif column == 5: return self.tasks[row].done return None def headerData(self, section, orientation, role=None): if role == QtCore.Qt.DisplayRole: if orientation == QtCore.Qt.Horizontal: return ["Задача", "Дата начала", "Дата конца", "Отдел", "Количество человек", "Трудоёмкость", "Выполнение"][section] 