Compare commits
No commits in common. "fb8bcc71e2901681e635d8a7d7ca823999f5ae29" and "17c65a50eab11d6f36b238ecccf4d7994118b814" have entirely different histories.
fb8bcc71e2
...
17c65a50ea
3 changed files with 2 additions and 20 deletions
|
@ -49,8 +49,7 @@ 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();
|
||||||
|
|
||||||
auto oldModel = ui_.salesView->model();
|
delete ui_.salesView->model();
|
||||||
ui_.salesView->setModel(nullptr);
|
|
||||||
|
|
||||||
if (retCode == QDialog::Accepted) {
|
if (retCode == QDialog::Accepted) {
|
||||||
marketplace_->sortSellers();
|
marketplace_->sortSellers();
|
||||||
|
@ -64,7 +63,6 @@ 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,
|
||||||
|
|
|
@ -9,9 +9,8 @@ SellerDialog::SellerDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent,
|
||||||
{
|
{
|
||||||
ui_.setupUi(this);
|
ui_.setupUi(this);
|
||||||
ui_.editButton->setVisible(false);
|
ui_.editButton->setVisible(false);
|
||||||
market_ = dynamic_cast<MainWindow*>(parent)->getMarketplace();
|
|
||||||
SellerModel* model =
|
SellerModel* model =
|
||||||
new SellerModel(market_, ui_.tableView);
|
new SellerModel(dynamic_cast<MainWindow*>(parent)->getMarketplace(), ui_.tableView);
|
||||||
ui_.tableView->setModel(model);
|
ui_.tableView->setModel(model);
|
||||||
ui_.tableView->setColumnHidden(0, true); // hide the uuid
|
ui_.tableView->setColumnHidden(0, true); // hide the uuid
|
||||||
connect(ui_.newButton, &QPushButton::clicked, this, &SellerDialog::on_newButton_clicked);
|
connect(ui_.newButton, &QPushButton::clicked, this, &SellerDialog::on_newButton_clicked);
|
||||||
|
@ -22,11 +21,6 @@ SellerDialog::SellerDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent,
|
||||||
&SellerDialog::onSellerViewSelectionChanged);
|
&SellerDialog::onSellerViewSelectionChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
SellerDialog::~SellerDialog()
|
|
||||||
{
|
|
||||||
delete ui_.tableView->model();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SellerDialog::on_newButton_clicked()
|
void SellerDialog::on_newButton_clicked()
|
||||||
{
|
{
|
||||||
ui_.tableView->reset();
|
ui_.tableView->reset();
|
||||||
|
@ -44,14 +38,6 @@ void SellerDialog::on_deleteButton_clicked()
|
||||||
if (selModel->hasSelection() == false)
|
if (selModel->hasSelection() == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (market_->getSales().size() > 0) {
|
|
||||||
QMessageBox(QMessageBox::Icon::Warning, "Hinweis",
|
|
||||||
"Da die Verkaufsphase schon begonnen hat (Artikel wurden bereits verkauft) können Sie keine Verkäufer mehr löschen.",
|
|
||||||
QMessageBox::StandardButton::Ok, this)
|
|
||||||
.exec();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto dlgResult =
|
auto dlgResult =
|
||||||
QMessageBox(QMessageBox::Icon::Warning, "Sind Sie sicher?",
|
QMessageBox(QMessageBox::Icon::Warning, "Sind Sie sicher?",
|
||||||
"Löschen wirkt sich direkt auf die Datenbank aus. Möchten Sie fortfahren?",
|
"Löschen wirkt sich direkt auf die Datenbank aus. Möchten Sie fortfahren?",
|
||||||
|
|
|
@ -14,7 +14,6 @@ class SellerDialog : public QDialog
|
||||||
public:
|
public:
|
||||||
SellerDialog(QWidget* parent = nullptr,
|
SellerDialog(QWidget* parent = nullptr,
|
||||||
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||||
~SellerDialog();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSellerViewSelectionChanged(const QItemSelection& selected,
|
void onSellerViewSelectionChanged(const QItemSelection& selected,
|
||||||
|
@ -26,7 +25,6 @@ class SellerDialog : public QDialog
|
||||||
void on_model_duplicateSellerNo(const QString& message);
|
void on_model_duplicateSellerNo(const QString& message);
|
||||||
virtual void accept() override;
|
virtual void accept() override;
|
||||||
Ui::SellerDialog ui_;
|
Ui::SellerDialog ui_;
|
||||||
Marketplace* market_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue