RecipeDB/model/recipe/ingredients/ingredientlistmodel.h

32 lines
770 B
C
Raw Permalink Normal View History

2018-02-12 13:24:11 +00:00
#ifndef INGREDIENTLISTMODEL_H
#define INGREDIENTLISTMODEL_H
#include <QAbstractListModel>
#include <QModelIndex>
2018-02-12 13:24:11 +00:00
#include "model/recipe/ingredients/recipeingredient.h"
2018-02-12 13:24:11 +00:00
class IngredientListModel : public QAbstractListModel
{
public:
IngredientListModel();
//Overridden methods.
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
2018-02-12 13:24:11 +00:00
//Custom methods to handle ingredient data.
void setIngredients(vector<Ingredient> ingredients);
bool addIngredient(Ingredient ri);
2018-03-10 12:22:04 +00:00
void deleteIngredient(int index);
vector<Ingredient> getIngredients();
2018-02-12 13:24:11 +00:00
private:
vector<Ingredient> ingredients;
//Helper for printing.
2018-02-12 13:24:11 +00:00
};
#endif // INGREDIENTLISTMODEL_H