-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSampleModel.hpp
48 lines (37 loc) · 965 Bytes
/
SampleModel.hpp
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "global.hpp"
class SampleModel : public QAbstractItemModel
{
Q_OBJECT
public:
SampleModel();
~SampleModel();
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &child) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
private:
QMap<int, QString> masters;
enum {
ColumnActions = 0,
ColumnControls,
};
QTimer dataUpdater;
QTimer dataChangedNofifier;
private slots:
void onDataUpdate();
void onDataChangedNotify();
};
class SampleModelView : public QMainWindow
{
Q_OBJECT
public:
SampleModelView();
~SampleModelView();
private:
QListView *list;
QTreeView *tree;
SampleModel *model;
};