SHARE
TWEET

Untitled

a guest Nov 9th, 2013 33 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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top