diff --git a/src/gui/sellerdialog.cpp b/src/gui/sellerdialog.cpp index 3088028..7063d79 100644 --- a/src/gui/sellerdialog.cpp +++ b/src/gui/sellerdialog.cpp @@ -18,6 +18,7 @@ void SellerDialog::on_newButton_clicked() { ui_.tableView->model()->insertRows(ui_.tableView->model()->rowCount(), 1); ui_.tableView->scrollToBottom(); + ui_.tableView->selectRow(ui_.tableView->model()->rowCount() - 1); } void SellerDialog::accept() diff --git a/src/gui/sellerdialog.ui b/src/gui/sellerdialog.ui index 28b9edd..1dc8f78 100644 --- a/src/gui/sellerdialog.ui +++ b/src/gui/sellerdialog.ui @@ -5,6 +5,14 @@ Qt::NonModal + + + 0 + 0 + 600 + 400 + + 0 @@ -38,7 +46,7 @@ - Neu + &Neu diff --git a/src/gui/sellermodel.cpp b/src/gui/sellermodel.cpp index 4f9815b..a88541d 100644 --- a/src/gui/sellermodel.cpp +++ b/src/gui/sellermodel.cpp @@ -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->createUuid(); seller->setSellerNo(marketplace_->getNextSellerNo()); marketplace_->getSellers().push_back(std::move(seller)); - endInsertRows(); + emit endInsertRows(); return true; } \ No newline at end of file