This repository has been archived on 2022-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
fanny-app/headers/eventmodel.h
dorian f7d5a111d0 added header to the event view, showing:
- creation date
- target date
- cleaning class

added one event block underneath the header indicating what the different fields contain
2018-12-26 23:44:24 +01:00

48 lines
974 B
C++

#ifndef EVENTMODEL_H
#define EVENTMODEL_H
#include <QObject>
#include <QAbstractListModel>
#include "headers/serverconn.h"
class EventModel : public QAbstractListModel
{
Q_OBJECT
public:
EventModel(QObject *parent = nullptr);
~EventModel();
enum DayRole {
GradeRole = Qt::DisplayRole,
HourRole,
ReplaceRole,
SubjectRole,
RoomRole,
ToRole,
TextRole
};
Q_ENUM(DayRole)
int rowCount(const QModelIndex & = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QHash<int, QByteArray> roleNames() const;
Q_INVOKABLE QStringList getHeader();
Q_INVOKABLE QVariantMap get(int row) const;
private:
struct Day {
QString grade;
QString hour;
QString replace;
QString subject;
QString room;
QString to;
QString text;
};
QList<Day> m_events;
};
#endif // EVENTMODEL_H