QDate date;
QTime time;
QString dish;
int count;
};
class Cuisine: public QAbstractTableModel
{
private:
static Cuisine *instance_;
public:
static Cuisine *getInstance();
QList<Order> orderList;
QDate dateFrom, dateTo;
int rowCount(const QModelIndex &parent = QModelIndex()) const ;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
void clear() {
orderList.clear();
dateFrom = QDate(3000, 1, 1);
dateTo = QDate(2000, 1, 1);
}
void addOrder(QString);
};
#endif // CUISINE_H
Файл graphform.h
#ifndef GRAPHFORM_H
#define GRAPHFORM_H
#include <QWidget>
#include "ui_graphform.h"
#include "qcustomplot/qcustomplot.h"
class GraphForm : public QWidget, public Ui::GraphForm
{
Q_OBJECT
public:
explicit GraphForm(QWidget *parent = 0);
QCustomPlot plot;
};
#endif // GRAPHFORM_H
Файл ingrform.h
#ifndef INGRFORM_H
#define INGRFORM_H
#include <QWidget>
#include "ui_ingrform.h"
#include "cuisine.h"
class IngrModel : public QAbstractTableModel
{
public:
int rowCount(const QModelIndex &parent = QModelIndex()) const ;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QList<Ingr> ingrList;
};
class IngrForm : public QWidget, public Ui::IngrForm
{
Q_OBJECT
public:
explicit IngrForm(QWidget *parent = 0);
IngrModel ingrModel;
IngrModel forecastModel;
public slots:
void slotIngrUpdateModel();
void slotForecast();
};
#endif // INGRFORM_H
Файл mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "ui_mainwindow.h"
#include "orderform.h"
#include "graphform.h"
#include "ingrform.h"
#include "cuisine.h"
class MainWindow : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
private:
OrderForm orderForm;
GraphForm graphForm;
IngrForm ingrForm;
public slots:
void slotLoadFile();
void slotImit();
void slotPlot();
};
#endif // MAINWINDOW_H
Файл orderform.h
#ifndef ORDERFORM_H
#define ORDERFORM_H
#include <QWidget>
#include "ui_orderform.h"
class OrderForm : public QWidget, public Ui::OrderForm
{
Q_OBJECT
public:
explicit OrderForm(QWidget *parent = 0);
};
#endif // ORDERFORM_H