Compare commits

..

2 commits

Author SHA1 Message Date
4143fc2e89 using paid button 2018-07-23 08:21:28 +02:00
0f786a04e1 message text improved 2018-07-23 08:21:05 +02:00
3 changed files with 14 additions and 3 deletions

View file

@ -17,6 +17,7 @@ MainWindow::MainWindow()
&MainWindow::on_actionEditSeller_triggered);
connect(ui_.sellerNoEdit, &QLineEdit::returnPressed, this,
&MainWindow::on_sellerNoEdit_checkSellerNo);
connect(ui_.paidButton, &QPushButton::clicked, this, &MainWindow::on_paidButton_triggered);
marketplace_ = std::make_unique<Marketplace>();
marketplace_->loadFromDb();
@ -25,7 +26,6 @@ MainWindow::MainWindow()
BasketModel* model = new BasketModel(getMarketplace(), ui_.basketView);
ui_.basketView->setModel(model);
ui_.basketView->setColumnHidden(0, true); // hide the uuid
}
void MainWindow::on_actionEditSeller_triggered()
@ -44,6 +44,14 @@ void MainWindow::on_actionEditSeller_triggered()
}
}
void MainWindow::on_paidButton_triggered()
{
if (marketplace_->basketSize() > 0) {
dynamic_cast<BasketModel*>(ui_.basketView->model())->finishSale();
}
return;
}
void MainWindow::on_sellerNoEdit_checkSellerNo()
{
using std::regex, std::regex_match, std::smatch;

View file

@ -17,10 +17,12 @@ class MainWindow : public QMainWindow
MainWindow();
Marketplace* getMarketplace() { return marketplace_.get(); }
private:
private slots:
void on_actionEditSeller_triggered();
void on_sellerNoEdit_checkSellerNo();
void on_paidButton_triggered();
private:
Ui::MainWindow ui_;
std::unique_ptr<Marketplace> marketplace_;
};

View file

@ -16,7 +16,8 @@ void PriceDialog::accept()
{
if (static_cast<int>(std::round(ui_.priceSpinBox->value() * 100.0L)) % 50 != 0) {
QMessageBox(QMessageBox::Icon::Warning, "Falsche Preiseingabe",
"Es sind 0,50 Cent-Schritte erlaubt", QMessageBox::StandardButton::Ok, this)
"Es sind nur 0,50 Cent-Schritte erlaubt.", QMessageBox::StandardButton::Ok,
this)
.exec();
} else {
QDialog::accept();