33 lines
No EOL
1.2 KiB
C++
33 lines
No EOL
1.2 KiB
C++
#ifndef BASKET_MODEL_H
|
|
#define BASKET_MODEL_H
|
|
|
|
#include <marketplace.h>
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
class BasketModel : public QAbstractTableModel
|
|
{
|
|
Q_OBJECT
|
|
|
|
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;
|
|
//virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
|
|
//virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
|
|
//virtual bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
|
|
void addArticle(Seller* seller, int price, const std::string& desc);
|
|
void finishSale();
|
|
void cancelSale();
|
|
virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
|
|
|
|
signals:
|
|
void basketDataChanged();
|
|
|
|
private:
|
|
Marketplace* marketplace_;
|
|
};
|
|
|
|
#endif |