@jdent said in How do I make a QTableView readonly?:
@Christian-Ehrlicher sorry did not find any info on ItemFlags for QTableView
In Qt's model-view paradigm the flags are returned by the model: Qt::ItemFlags QAbstractItemModel::flags(const QModelIndex &index) const, values flags Qt::ItemFlags. Qt::ItemIsEditable determines whether the model tells the view items are editable or not. A view like QTableView will call this, behind the scenes without you doing anything, and make its interface correspond to what the model wants. @mpergand's implementation does not return Qt::ItemIsEditable so items won't be editable. QTreeView will show items as non-editable.