kima2/src/gui/basketmodel.h

31 lines
940 B
C
Raw Normal View History

2018-07-22 20:10:22 +02:00
#ifndef BASKET_MODEL_H
#define BASKET_MODEL_H
2019-10-10 08:09:16 +02:00
#include <core/marketplace.h>
2018-07-22 20:10:22 +02:00
#include <QAbstractTableModel>
class BasketModel : public QAbstractTableModel
{
2019-10-07 14:08:01 +02:00
Q_OBJECT
2018-07-22 20:10:22 +02:00
public:
explicit BasketModel(Marketplace* market, QObject* parent = nullptr);
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override;
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
void addArticle(Seller* seller, int price, const std::string& desc);
2018-07-22 20:10:22 +02:00
void finishSale();
2018-07-23 13:39:49 +02:00
void cancelSale();
virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
2018-07-22 20:10:22 +02:00
2019-10-07 14:08:01 +02:00
signals:
2018-07-26 08:34:01 +02:00
void basketDataChanged();
2018-07-22 20:10:22 +02:00
private:
Marketplace* marketplace_;
};
2019-10-10 08:09:16 +02:00
#endif