Hi,
I have a Qtableview in my project and i want that the first column is editable but not the second column.
How i can setEnebled(false) only for the second column?
Thanks, Bye
Hi,
I have a Qtableview in my project and i want that the first column is editable but not the second column.
How i can setEnebled(false) only for the second column?
Thanks, Bye
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 Code:
{ 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