fix cashing app

This commit is contained in:
Martin Brodbeck 2018-07-26 08:55:03 +02:00
parent 3ec2143f28
commit 9041d34357

View file

@ -41,14 +41,16 @@ MainWindow::MainWindow()
connect(ui_.cancelAllArticlesButton, &QPushButton::clicked, this, connect(ui_.cancelAllArticlesButton, &QPushButton::clicked, this,
&MainWindow::onCancelAllArticlesButtonClicked); &MainWindow::onCancelAllArticlesButtonClicked);
connect(static_cast<BasketModel*>(ui_.basketView->model()), &BasketModel::basketDataChanged, connect(static_cast<BasketModel*>(ui_.basketView->model()), &BasketModel::basketDataChanged,
static_cast<SaleModel*>(ui_.salesView->model()), static_cast<SaleModel*>(ui_.salesView->model()), &SaleModel::onBasketDataChanged);
&SaleModel::onBasketDataChanged);
} }
void MainWindow::on_actionEditSeller_triggered() void MainWindow::on_actionEditSeller_triggered()
{ {
auto dialog = std::make_unique<SellerDialog>(this); auto dialog = std::make_unique<SellerDialog>(this);
int retCode = dialog->exec(); int retCode = dialog->exec();
ui_.salesView->setModel(nullptr);
if (retCode == QDialog::Accepted) { if (retCode == QDialog::Accepted) {
marketplace_->sortSellers(); marketplace_->sortSellers();
marketplace_->storeToDb(); marketplace_->storeToDb();
@ -59,6 +61,12 @@ void MainWindow::on_actionEditSeller_triggered()
statusBar()->showMessage("Änderungen an den Verkäufer-Stammdaten verworfen!", statusBar()->showMessage("Änderungen an den Verkäufer-Stammdaten verworfen!",
STATUSBAR_TIMEOUT); STATUSBAR_TIMEOUT);
} }
ui_.salesView->setModel(new SaleModel(getMarketplace(), ui_.salesView));
ui_.salesView->setColumnHidden(2, true);
ui_.salesView->resizeColumnToContents(0);
connect(static_cast<BasketModel*>(ui_.basketView->model()), &BasketModel::basketDataChanged,
static_cast<SaleModel*>(ui_.salesView->model()), &SaleModel::onBasketDataChanged);
} }
void MainWindow::on_paidButton_triggered() void MainWindow::on_paidButton_triggered()
@ -68,7 +76,6 @@ void MainWindow::on_paidButton_triggered()
dynamic_cast<BasketModel*>(ui_.basketView->model())->finishSale(); dynamic_cast<BasketModel*>(ui_.basketView->model())->finishSale();
ui_.lastPriceLabel1->setText(lastPrice); ui_.lastPriceLabel1->setText(lastPrice);
ui_.lastPriceLabel2->setText(lastPrice); ui_.lastPriceLabel2->setText(lastPrice);
// static_cast<SaleModel*>(ui_.salesView->model())->onDataChanged();
} }
} }