I’m trying to teach myself how to use the QStyledItemDelegate class correctly. Qt’s got a fantastic example that I read here: Qt Spin Box Delegate Example.
But here’s a question I can’t seem to answer. Let’s take a look at their example screenshot.

How would I write SpinBoxDelegate in their example such that I could only edit part of the data, say, only items in column 2?
I’m assuming you’re already re-implementing
QAbstractItemDelegate::createEditor()The simplest way to indicate that a certain index in your table shouldn’t be editable is to return
NULLfrom this function, for example:You can get fancier by stuffing additional information in your model and retrieving it with
QModelIndex::data()