code: def setData(self, index, value, role=Qt.EditRole):
          
          item = self.itemAt(index)
          if not item:
              return False
          d = item.declaration
          if role == Qt.CheckStateRole:
              checked = value == Qt.Checked
              if checked != d.checked:
                  d.checked = checked
                  d.toggled(checked)
              return True
          elif role == Qt.EditRole:
              if value != d.text:
                  d.text = value
              return True
          return super(QAbstractAtomItemModel, self).setData(index, value, role)
docs: Set the data for the item at the given index to the given value.