qt5
Line | |
---|
1 | #ifndef EVENTMODEL_H |
---|
2 | #define EVENTMODEL_H |
---|
3 | |
---|
4 | #include <QAbstractItemModel> |
---|
5 | |
---|
6 | #include "event.h" |
---|
7 | |
---|
8 | class EventModel : public QAbstractItemModel |
---|
9 | { |
---|
10 | public: |
---|
11 | EventModel(); |
---|
12 | QVariant data(const QModelIndex& index, int role) const; |
---|
13 | QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; |
---|
14 | QModelIndex parent ( const QModelIndex & index ) const; |
---|
15 | int columnCount ( const QModelIndex & parent = QModelIndex() ) const; |
---|
16 | int rowCount ( const QModelIndex & parent = QModelIndex() ) const; |
---|
17 | |
---|
18 | private: |
---|
19 | struct Group |
---|
20 | { |
---|
21 | Group(const QString & title, |
---|
22 | int firstEventIndex) : |
---|
23 | |
---|
24 | mTitle(title), |
---|
25 | mFirstEventIndex(firstEventIndex), |
---|
26 | mChildCount(0) |
---|
27 | {} |
---|
28 | |
---|
29 | QString mTitle; |
---|
30 | int mFirstEventIndex; |
---|
31 | int mChildCount; |
---|
32 | }; |
---|
33 | |
---|
34 | private: |
---|
35 | void createTimeGroups(); |
---|
36 | |
---|
37 | private: |
---|
38 | QList<Event> mEvents; |
---|
39 | QList<Group> mGroups; |
---|
40 | QHash<int, int> mParents; |
---|
41 | }; |
---|
42 | |
---|
43 | #endif // EVENTMODEL_H |
---|
Note: See
TracBrowser
for help on using the repository browser.