source: src/model/eventmodel.h @ 9bbb44e

qt5
Last change on this file since 9bbb44e was d0d0a66, checked in by komarma <komarma@…>, 13 years ago

Creating EventModel? class

  • Property mode set to 100644
File size: 992 bytes
Line 
1#ifndef EVENTMODEL_H
2#define EVENTMODEL_H
3
4#include <QAbstractItemModel>
5
6#include "event.h"
7
8class EventModel : public QAbstractItemModel
9{
10public:
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
18private:
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
34private:
35    void createTimeGroups();
36
37private:
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.