Advertisement
Guest User

Untitled

a guest
Nov 9th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //roleNames needs to be reimplemented
  2.  
  3. //in .h
  4. public:
  5.     virtual QHash<int, QByteArray> roleNames() const;
  6. private:
  7.     QHash<int, QByteArray> _roles;
  8. //in .c
  9. NotificationsModel::NotificationsModel(QObject *parent) :
  10.     QAbstractListModel(parent)
  11. {
  12.     _roles[Qt::DisplayRole] = QByteArray("title");
  13.     _roles[ObjectRole] = QByteArray("object");
  14.     _roles[BodyRole] = QByteArray("body");
  15.     _roles[CountRole] = QByteArray("count");
  16. }
  17.  
  18. QHash<int, QByteArray> NotificationsModel::roleNames() const
  19. {
  20.     return _roles;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement