replace model correctly
This commit is contained in:
parent
17c65a50ea
commit
2003530587
1 changed files with 3 additions and 1 deletions
|
@ -49,7 +49,8 @@ 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();
|
||||||
|
|
||||||
delete ui_.salesView->model();
|
auto oldModel = ui_.salesView->model();
|
||||||
|
ui_.salesView->setModel(nullptr);
|
||||||
|
|
||||||
if (retCode == QDialog::Accepted) {
|
if (retCode == QDialog::Accepted) {
|
||||||
marketplace_->sortSellers();
|
marketplace_->sortSellers();
|
||||||
|
@ -63,6 +64,7 @@ void MainWindow::on_actionEditSeller_triggered()
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_.salesView->setModel(new SaleModel(getMarketplace(), ui_.salesView));
|
ui_.salesView->setModel(new SaleModel(getMarketplace(), ui_.salesView));
|
||||||
|
delete oldModel;
|
||||||
ui_.salesView->setColumnHidden(2, true);
|
ui_.salesView->setColumnHidden(2, true);
|
||||||
ui_.salesView->resizeColumnToContents(0);
|
ui_.salesView->resizeColumnToContents(0);
|
||||||
connect(static_cast<BasketModel*>(ui_.basketView->model()), &BasketModel::basketDataChanged,
|
connect(static_cast<BasketModel*>(ui_.basketView->model()), &BasketModel::basketDataChanged,
|
||||||
|
|
Loading…
Reference in a new issue