Guest User

Untitled

a guest
Jun 21st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. class MyTableModel : public QAbstractTableModel {
  2. Q_OBJECT
  3. QList<QHash<int, QHash<int, QVariant> *> *> m_data;
  4. /*...*/
  5. };
  6.  
  7. MyTableModel::~TMusicTableModel() {
  8. /* Should I deallocate QList items? */
  9. }
  10.  
  11. MyTableModel::setData(int row, int col, int type, QVariant value) {
  12. /* inserting a new data field */
  13. QHash<int, QHash<int, QVariant> *> *row_hash = new QHash<int, QHash<int, QVariant> *>();
  14. QHash<int, QVariant> *role_hash = new QHash<int, QVariant>();
  15. type_hash->insert(type, value);
  16. row_hash->insert(col, type_hash);
  17. m_data.insert(row, row_hash);
  18. return true;
  19. }
Add Comment
Please, Sign In to add comment