Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyTableModel : public QAbstractTableModel {
- Q_OBJECT
- QList<QHash<int, QHash<int, QVariant> *> *> m_data;
- /*...*/
- };
- MyTableModel::~TMusicTableModel() {
- /* Should I deallocate QList items? */
- }
- MyTableModel::setData(int row, int col, int type, QVariant value) {
- /* inserting a new data field */
- QHash<int, QHash<int, QVariant> *> *row_hash = new QHash<int, QHash<int, QVariant> *>();
- QHash<int, QVariant> *role_hash = new QHash<int, QVariant>();
- type_hash->insert(type, value);
- row_hash->insert(col, type_hash);
- m_data.insert(row, row_hash);
- return true;
- }
Add Comment
Please, Sign In to add comment