/
calendarattendeemodel.h
53 lines (40 loc) · 1.26 KB
/
calendarattendeemodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef CALENDARATTENDEEMODEL_H
#define CALENDARATTENDEEMODEL_H
#include <QVector>
#include <QAbstractListModel>
#include "calendareventquery.h"
class CalendarAttendeeModel : public QAbstractListModel
{
Q_OBJECT
Q_ENUMS(SectionRoles)
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
enum AttendeeRoles {
NameRole = Qt::UserRole,
EmailRole,
IsOrganizerRole,
ParticipationRoleRole,
ParticipationStatusRole,
ParticipationSectionRole
};
enum SectionRoles {
RequiredSection = Person::RequiredParticipant,
OptionalSection = Person::OptionalParticipant,
NonSection = Person::NonParticipant,
ChairSection = Person::ChairParticipant,
OrganizerSection
};
explicit CalendarAttendeeModel(QObject *parent = nullptr);
virtual ~CalendarAttendeeModel();
int rowCount(const QModelIndex &index) const override;
QVariant data(const QModelIndex &index, int role) const override;
int count() const;
Q_INVOKABLE void doFill(const QList<QObject*>& people);
signals:
void countChanged();
protected:
virtual QHash<int, QByteArray> roleNames() const override;
private:
QVector<Person*> m_people;
};
#endif // CALENDARATTENDEEMODEL_H