From 1a82a4147b0cf56aee014d81f05062a4a739a9dc Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Mon, 30 Sep 2019 10:28:03 +0200 Subject: [PATCH] Show correct last price when cancelling sold items --- src/gui/mainwindow.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 1b2f11c..3cd9ccb 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -145,6 +145,8 @@ MainWindow::MainWindow() setWindowIcon(QIcon(":/misc/kima2.ico")); updateStatLabel(); + ui_.lastPriceLabel1->setText(formatCentAsEuroString(0).c_str()); + ui_.lastPriceLabel2->setText(formatCentAsEuroString(0).c_str()); } void MainWindow::onActionEditSellerTriggered() @@ -363,6 +365,14 @@ void MainWindow::onCancelSaleButtonClicked([[maybe_unused]] bool checked) } ui_.salesView->collapseAll(); + + QString lastPriceValue(formatCentAsEuroString(0).c_str()); + if (ui_.salesView->model()->rowCount() > 0) { + lastPriceValue = ui_.salesView->model()->data(ui_.salesView->model()->index(0, 1)).toString(); + } + ui_.lastPriceLabel1->setText(lastPriceValue); + ui_.lastPriceLabel2->setText(lastPriceValue); + updateStatLabel(); } @@ -585,3 +595,4 @@ void MainWindow::updateStatLabel() ui_.statLabel->setText(statistics.c_str()); } +