source: src/mvc/eventmodel.h @ 92995da

qt5
Last change on this file since 92995da was 92995da, checked in by pavelpa <pavelpa@…>, 13 years ago

just some directory renaming

  • renamed 'model' to 'mvc' (Model-View-Controller), since it contains also 'delegate' and 'view'
  • Property mode set to 100644
File size: 1.1 KB
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    void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB
18
19private:
20    struct Group
21    {
22        Group(const QString & title,
23              int firstEventIndex) :
24
25            mTitle(title),
26            mFirstEventIndex(firstEventIndex),
27            mChildCount(0)
28        {}
29
30        QString mTitle;
31        int mFirstEventIndex;
32        int mChildCount;
33    };
34
35private:
36    void createTimeGroups();
37
38private:
39    QList<Event> mEvents;
40    QList<Group> mGroups;
41    QHash<int, int> mParents;
42};
43
44#endif // EVENTMODEL_H
45
Note: See TracBrowser for help on using the repository browser.