Hi, i think you can solve this problem in two ways:
1. if you use own model class you can reipliment flags method like this:
Qt
::ItemFlags Model
::flags(const QModelIndex &index
) const {
if (!index.isValid())
return 0;
if (index.column() == 1)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
Qt::ItemFlags Model::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
if (index.column() == 1)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
To copy to clipboard, switch view to plain text mode
2. Or just use delegation mechanism - subclass QStyledItemDelegate, reimplement necessary methods in particular method createEditor (should return 0 for second column index). Set up delegation class to you QTableView class using setItemDelegateForColumn method
Bookmarks