The role you need to use in QAbstractItemModel::data is Qt::CheckStateRole. I think the method should look like this:

Qt Code:
  1. QVariant PurchaseOrdersRequests::data ( const QModelIndex & index, int role ) const
  2. {
  3. if (!index.isValid())
  4. {
  5. return QVariant();
  6. }
  7. QSqlRecord rec = record(index.row());
  8. QVariant val = rec.value(index.column());
  9.  
  10. switch (role)
  11. {
  12. case Qt::CheckStateRole:
  13. if (index.column() != 6)
  14. return QVariant();
  15. else if (val.toInt() == 0) // or whatever
  16. return Qt::Unchecked;
  17. else
  18. return Qt::Checked;
  19. case Qt::DisplayRole:
  20. return val;
  21. default:
  22. return QVariant();
  23. }
  24. }
To copy to clipboard, switch view to plain text mode 

Depending on the type stored in val, QVariant::toString() may well return an empty string. Use QVariant::typeName() to check what type it is. I think it's best to just pass on the QVariant value.

No guarantees, I did not check the code above, but I hope it gives you an idea.