Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QStyledItemDelegate and QStandardItem preventing change text , enable only select and copy
umen242 last edited by
have a simple QStandardItem and QTableView and QStyledItemDelegate. They have delegates , I would like to disable the possibility for user to change the content of a column in the table, and allow only select and copy. I guess it related to QStyledItemDelegate::createEditor.
When I set it to return 0, it just disable everything.
@QWidget *InfoTableItemDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
// return QStyledItemDelegate::createEditor(parent, option, index);
my question is , how can i defined it so i can only select and copy , and disable the option to edit it like delete or change the text
terenty last edited by
Hi! I am not sure but maybe "QStandardItem::setFlags":http://doc.qt.digia.com/qt/qstandarditem.html#setFlags will help