|
|
|
@ -22,6 +22,10 @@ QVariant SellerModel::data(const QModelIndex& index, int role) const
|
|
|
|
|
return QVariant();
|
|
|
|
|
|
|
|
|
|
Seller* seller = marketplace_->getSellers().at(index.row()).get();
|
|
|
|
|
|
|
|
|
|
if (seller->getState() == Seller::State::DELETE)
|
|
|
|
|
return QVariant::Invalid;
|
|
|
|
|
|
|
|
|
|
switch (index.column()) {
|
|
|
|
|
case 0:
|
|
|
|
|
return seller->getUuidAsString().c_str();
|
|
|
|
@ -117,12 +121,12 @@ bool SellerModel::setData(const QModelIndex& index, const QVariant& value, int r
|
|
|
|
|
|
|
|
|
|
bool SellerModel::insertRows(int row, int count, const QModelIndex& parent)
|
|
|
|
|
{
|
|
|
|
|
beginInsertRows(parent, row, row + count - 1);
|
|
|
|
|
emit beginInsertRows(parent, row, row + count - 1);
|
|
|
|
|
auto seller = std::make_unique<Seller>();
|
|
|
|
|
seller->createUuid();
|
|
|
|
|
seller->setSellerNo(marketplace_->getNextSellerNo());
|
|
|
|
|
marketplace_->getSellers().push_back(std::move(seller));
|
|
|
|
|
endInsertRows();
|
|
|
|
|
emit endInsertRows();
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|