2018-03-11 11:53:30 +00:00
|
|
|
#ifndef RECIPETABLEMODEL_H
|
|
|
|
#define RECIPETABLEMODEL_H
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
|
|
|
|
#include "model/recipe/recipe.h"
|
2018-03-29 14:09:58 +00:00
|
|
|
#include "utils/stringutils.h"
|
2018-03-11 11:53:30 +00:00
|
|
|
|
|
|
|
class RecipeTableModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RecipeTableModel();
|
|
|
|
RecipeTableModel(vector<Recipe> recipes);
|
|
|
|
|
|
|
|
//Overridden methods.
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
|
|
|
|
|
|
|
//Normal methods.
|
|
|
|
void setRecipes(vector<Recipe> recipes);
|
2018-03-29 14:09:58 +00:00
|
|
|
Recipe getRecipeAt(int index);
|
|
|
|
void clear();
|
2018-03-11 11:53:30 +00:00
|
|
|
private:
|
|
|
|
vector<Recipe> recipes;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RECIPETABLEMODEL_H
|