qt5
Last change
on this file since 4693fa6 was
4693fa6,
checked in by pavelpa <pavelpa@…>, 13 years ago
|
changed 'Activity' -> 'Track'
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
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 | static const QString COMMA_SEPARATOR; |
---|
12 | public: |
---|
13 | EventModel(); |
---|
14 | QVariant data(const QModelIndex& index, int role) const; |
---|
15 | QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; |
---|
16 | QModelIndex parent ( const QModelIndex & index ) const; |
---|
17 | int columnCount ( const QModelIndex & parent = QModelIndex() ) const; |
---|
18 | int rowCount ( const QModelIndex & parent = QModelIndex() ) const; |
---|
19 | void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB |
---|
20 | void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB |
---|
21 | void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events grouped by Track from the DB |
---|
22 | // a method to force 'EventModel' emit signal 'dataChanged()' |
---|
23 | // a 'view', eg. 'TreeView' listens for this signal and redraws changed items(indexes) |
---|
24 | void emitDataChangedSignal(const QModelIndex &aTopLeft, const QModelIndex &aBottomRight); |
---|
25 | |
---|
26 | private: |
---|
27 | struct Group |
---|
28 | { |
---|
29 | Group(const QString & title, |
---|
30 | int firstEventIndex) : |
---|
31 | |
---|
32 | mTitle(title), |
---|
33 | mFirstEventIndex(firstEventIndex), |
---|
34 | mChildCount(0) |
---|
35 | {} |
---|
36 | |
---|
37 | QString mTitle; |
---|
38 | int mFirstEventIndex; |
---|
39 | int mChildCount; |
---|
40 | }; |
---|
41 | |
---|
42 | private: |
---|
43 | void createTimeGroups(); |
---|
44 | void createTrackGroups(); |
---|
45 | void clearModel(); |
---|
46 | |
---|
47 | private: |
---|
48 | QList<Event> mEvents; |
---|
49 | QList<Group> mGroups; |
---|
50 | QHash<int, int> mParents; |
---|
51 | }; |
---|
52 | |
---|
53 | #endif // EVENTMODEL_H |
---|
54 | |
---|
Note: See
TracBrowser
for help on using the repository browser.