Show correct last price when cancelling sold items

This commit is contained in:
Martin Brodbeck 2019-09-30 10:28:03 +02:00
parent ddb06c73a8
commit 1a82a4147b

View file

@ -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());
}