This can be done via model's data(). You would subclass QSqlQueryModel and reimplement its data(). Get the data from the base class and add a few checks. When the index is valid and the role is Qt::FontRole, make the font striked out if needed. Notice that there's QFont::setStrikedOut(bool) for that. Also, when the index is valid and the role is Qt::DecorationRole, return a corresponding icon (personal/professional). Otherwise return the value retrieved from the base class. Here's something for you to start with:
Qt Code:
  1. QVariant MySqlQueryModel::data(const QModelIndex& index, int role) const
  2. {
  3. if (!index.isValid())
  4. return QVariant();
  5.  
  6. QVariant value = QSqlQueryModel::data(index, role);
  7. switch (role)
  8. {
  9. case Qt::FontRole:
  10. {
  11. QFont font;
  12. if (value.isValid())
  13. font = qvariant_cast<QFont>(value);
  14. if (taskIsDone)
  15. font.setStrikedOut(true);
  16. return QVariant::fromValue(font);
  17. }
  18. case Qt::DecorationRole:
  19. {
  20. ...
  21. if (professional)
  22. return QVariant::fromValue(professionalIcon);
  23. else
  24. return QVariant::fromValue(personalIcon);
  25. }
  26. default:
  27. return value;
  28. }
  29. }
To copy to clipboard, switch view to plain text mode