You don't need to modify the selection model. You can tell the view which items can be selected by using the Qt::ItemIsSelectable flag in your data model.
Inherit your model and overwrite QAbstractItemModel::flags:
Qt Code:
Qt::ItemFlags MyModel::flags(const QModelIndex& index) const { if (/* user is allowd to select index.row() */) else }To copy to clipboard, switch view to plain text mode
Bookmarks