connecting basket model and sale model

This commit is contained in:
Martin Brodbeck 2018-07-26 08:34:01 +02:00
parent f697487d6b
commit 3ec2143f28
5 changed files with 23 additions and 2 deletions

View file

@ -155,4 +155,14 @@ QVariant SaleModel::headerData(int section, Qt::Orientation orientation, int rol
return QStringLiteral("%1").arg(section);
} else
return "";
}
void SaleModel::onBasketDataChanged()
{
emit beginResetModel();
auto& sales = marketplace_->getSales();
std::sort(sales.begin(), sales.end(), [](const auto& lhs, const auto& rhs) {
return lhs->getTimestamp() > rhs->getTimestamp();
});
emit endResetModel();
}