QModelIndex index = myModel->index(2, 1, QModelIndex()); Qt::ItemFlags flags = index.flags();
if (index.flags() & Qt::ItemIsEditable) { myModel->setData(index, "new value"); }This example checks if the index is editable by using the bitwise AND operator with the Qt::ItemIsEditable flag. If it is editable, we set the data at the index to a new value. The QModelIndex and QModelIndex flags are part of the Qt Core module.