PDA

View Full Version : Make a column readonly/not editable in QTableView?



qlands
29th July 2011, 14:33
Hi,

How can I make the cells of a column in a QTableView not editable? I am using QAbstractTableModel

Thanks,
Carlos.

mcosta
29th July 2011, 21:18
You can set a Item Delegate for Column with QAbstractItemView::setItemDelegateForColumn() and implements a read-only delegate.

Alternative you can your model and in QAbstractItemModel::flags you can remove the Qt::ItemIsEditable for specified column

qlands
31st July 2011, 15:51
Cool!. Thanks.

yunxiaodong
3rd August 2011, 10:44
very good. i do it