qt5
Last change
on this file since 28d9e28 was
f6300c7,
checked in by korrco <korrco@…>, 13 years ago
|
activities tab implemented - not finished yet
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Rev | Line | |
---|
[d0d0a66] | 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; |
---|
[969a840] | 17 | void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB |
---|
[6f39595] | 18 | void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB |
---|
[f6300c7] | 19 | void loadEventsByActivities(const QDate &aDate, int aConferenceId); // loads Events grouped by Activities from the DB |
---|
[67c59a7] | 20 | // a method to force 'EventModel' emit signal 'dataChanged()' |
---|
| 21 | // a 'view', eg. 'TreeView' listens for this signal and redraws changed items(indexes) |
---|
| 22 | void emitDataChangedSignal(const QModelIndex &aTopLeft, const QModelIndex &aBottomRight); |
---|
[d0d0a66] | 23 | |
---|
| 24 | private: |
---|
| 25 | struct Group |
---|
| 26 | { |
---|
| 27 | Group(const QString & title, |
---|
| 28 | int firstEventIndex) : |
---|
| 29 | |
---|
| 30 | mTitle(title), |
---|
| 31 | mFirstEventIndex(firstEventIndex), |
---|
| 32 | mChildCount(0) |
---|
| 33 | {} |
---|
| 34 | |
---|
| 35 | QString mTitle; |
---|
| 36 | int mFirstEventIndex; |
---|
| 37 | int mChildCount; |
---|
| 38 | }; |
---|
| 39 | |
---|
| 40 | private: |
---|
| 41 | void createTimeGroups(); |
---|
[f6300c7] | 42 | void createActivityGroups(); |
---|
| 43 | void clearModel(); |
---|
[d0d0a66] | 44 | |
---|
| 45 | private: |
---|
| 46 | QList<Event> mEvents; |
---|
| 47 | QList<Group> mGroups; |
---|
| 48 | QHash<int, int> mParents; |
---|
| 49 | }; |
---|
| 50 | |
---|
| 51 | #endif // EVENTMODEL_H |
---|
[69393c0] | 52 | |
---|
Note: See
TracBrowser
for help on using the repository browser.