create article with correct cash point no

This commit is contained in:
Martin Brodbeck 2018-07-30 13:49:23 +02:00
parent 9e85e2892d
commit c3b17fbb8b
1 changed files with 2 additions and 15 deletions

View File

@ -1,6 +1,7 @@
#include "basketmodel.h"
#include <QFont>
#include <QSettings>
BasketModel::BasketModel(Marketplace* market, QObject* parent)
: QAbstractTableModel(parent), marketplace_(market)
@ -79,20 +80,6 @@ QVariant BasketModel::headerData(int section, Qt::Orientation orientation, int r
return "";
}
/* bool BasketModel::insertRows(int row, int count, const QModelIndex& parent)
{
//emit beginInsertRows(parent, row, row + count - 1);
//auto article = std::make_unique<Article>();
//article->createUuid();
//article->setArticleNo(marketplace_->getNextArticleNo());
//marketplace_->addArticleToBasket(std::move(article));
//emit endInsertRows();
emit layoutChanged();
return true;
} */
void BasketModel::addArticle(Seller* seller, int price)
{
emit beginInsertRows(QModelIndex(), marketplace_->getBasket().size(),
@ -100,8 +87,8 @@ void BasketModel::addArticle(Seller* seller, int price)
auto article = std::make_unique<Article>(price);
article->createUuid();
article->setArticleNo(marketplace_->getNextArticleNo());
article->setSourceNo(QSettings().value("global/cashPointNo").toInt());
article->setSeller(seller);
// std::cout << "!!! Neuer Artikel: " << article->getPrice() << " Cent \n";
marketplace_->addArticleToBasket(std::move(article));
emit endInsertRows();
}