show something in the statusbar.

This commit is contained in:
Martin Brodbeck 2018-07-17 10:37:21 +02:00
parent 5eef98074e
commit 300c883fdc

View file

@ -2,14 +2,19 @@
#include "sellerdialog.h" #include "sellerdialog.h"
constexpr int STATUSBAR_TIMEOUT = 5000;
MainWindow::MainWindow() MainWindow::MainWindow()
{ {
ui_.setupUi(this); ui_.setupUi(this);
connect(ui_.actionQuit, &QAction::triggered, qApp, QApplication::quit); connect(ui_.actionQuit, &QAction::triggered, qApp, QApplication::quit);
connect(ui_.actionEditSeller, &QAction::triggered, this, &MainWindow::on_actionEditSeller_triggered); connect(ui_.actionEditSeller, &QAction::triggered, this,
&MainWindow::on_actionEditSeller_triggered);
marketplace_ = std::make_unique<Marketplace>(); marketplace_ = std::make_unique<Marketplace>();
marketplace_->loadFromDb();
statusBar()->showMessage("Gespeicherte Daten wurden geladen.", STATUSBAR_TIMEOUT);
} }
void MainWindow::on_actionEditSeller_triggered() void MainWindow::on_actionEditSeller_triggered()
@ -18,7 +23,11 @@ void MainWindow::on_actionEditSeller_triggered()
int retCode = dialog->exec(); int retCode = dialog->exec();
if (retCode == QDialog::Accepted) { if (retCode == QDialog::Accepted) {
marketplace_->storeToDb(); marketplace_->storeToDb();
statusBar()->showMessage("Änderungen an den Verkäufer-Stammdaten gespeichert.",
STATUSBAR_TIMEOUT);
} else { } else {
marketplace_->loadFromDb(); marketplace_->loadFromDb();
statusBar()->showMessage("Änderungen an den Verkäufer-Stammdaten <b>verworfen</b>.",
STATUSBAR_TIMEOUT);
} }
} }