OK I worked out what was happening.
data() was returning a checkbox AND a value. To stop it, I had to modify it:
{
if (index.column() == 6)
{
if (role == Qt::CheckStateRole)
else if (role == Qt::DisplayRole)
return QVariant();
// Don't show value !! }
return value;
}
QVariant PurchaseOrdersRequests::data ( const QModelIndex & index, int role ) const
{
QVariant value = QStandardItemModel::data(index, role);
if (index.column() == 6)
{
if (role == Qt::CheckStateRole)
return (QStandardItemModel::data(index).toInt() != 0) ? Qt::Checked : Qt::Unchecked;
else if (role == Qt::DisplayRole)
return QVariant(); // Don't show value !!
}
return value;
}
To copy to clipboard, switch view to plain text mode
Bookmarks