Quote Originally Posted by anda_skoa View Post
Couple of things:

- in order to be able to use this class as a QQuickImageProvider, it needs to have a "is-a" relation ship, i.e. publically inherit from QQuickImageProvider
- in data() it doesn't make sense to use the role as given to query the base class, after all these roles will most often be your custom roles and have no meaning for the base class
- you are missing the roleNames() override that returns the mapping of role names (used in QML) to role numbers (using in the C++ API).

Cheers,
_
Well, class is publicly inherited from QQuickImageProvider:
Qt Code:
  1. class UePeopleModel : public QSqlQueryModel, QQuickImageProvider
To copy to clipboard, switch view to plain text mode 
I've upgraded function data(), is now ok:
Qt Code:
  1. QVariant UePeopleModel::data(const QModelIndex &index,
  2. int role) const
  3. {
  4. QVariant value=QSqlQueryModel::data(index,
  5. role);
  6. if(value.isValid())
  7. {
  8. switch(role)
  9. {
  10. case ueRoleName:
  11. {
  12. return value.toString();
  13. } // case
  14.  
  15. case ueRoleImage:
  16. {
  17. return QString::number(index.row());
  18. } // case
  19.  
  20. default:
  21. value=QVariant();
  22. } // switch
  23. } // if
  24.  
  25. return value;
  26. } // data
To copy to clipboard, switch view to plain text mode 
But what do I have to put inside method UePeopleModel::image?

Sincerely yours,
Marko