You don't set a flag, you return flags whenever someone asks for them. When the model tells the environment that a particular index has changed its data, all the views will probably re-ask for the flags so at this point you may return something different than before.
Qt::ItemFlags MyModel::flags(...) const {
Qt::ItemFlags defFlags = BaseClass::flags(index);
if(shouldBeDisabled(index))
defFlags &= ~Qt::ItemIsEnabled;
return defFlags;
};
Qt::ItemFlags MyModel::flags(...) const {
Qt::ItemFlags defFlags = BaseClass::flags(index);
if(shouldBeDisabled(index))
defFlags &= ~Qt::ItemIsEnabled;
return defFlags;
};
To copy to clipboard, switch view to plain text mode
Bookmarks