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/foodplanmodel.h

45 lines
949 B
C++

#ifndef FOODPLANMODEL_H
#define FOODPLANMODEL_H
#include <QAbstractListModel>
#include <QtDebug>
#include "serverconn.h"
class FoodPlanModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit FoodPlanModel(QObject *parent = nullptr);
~FoodPlanModel();
enum DishRole {
CookteamRole = Qt::DisplayRole,
DateRole,
MainDishRole,
MainDishVegRole,
GarnishRole,
DessertRole
};
Q_ENUM(DishRole)
int rowCount(const QModelIndex & = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QHash<int, QByteArray> roleNames() const;
Q_INVOKABLE QVariantMap get(int row) const;
private:
struct Dish {
QString cookteam;
QString date;
QString mainDish;
QString mainDishVeg;
QString garnish;
QString dessert;
};
QList<Dish> m_foodPlan;
};
#endif // FOODPLANMODEL_H