-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtreemodel.h
29 lines (23 loc) · 842 Bytes
/
treemodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef TREEMODEL_H
#define TREEMODEL_H
#include <QAbstractItemModel>
#include "treeitem.h"
class
TreeModel : public QAbstractItemModel
{
Q_OBJECT
public:
TreeModel(const QMap<QString,QString> &data, QObject *parent = 0);
~TreeModel();
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QModelIndex index(int row, int column, const QModelIndex &parent) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
private:
void setupModelData(const QMap<QString,QString> &entries, TreeItem *rootItem);
TreeItem *rootItem;
};
#endif // TREEMODEL_H