The calculation of how many harvest shares are expected in total.
This commit is contained in:
@ -16,14 +16,23 @@ SummaryWidget::SummaryWidget(std::shared_ptr<ModelSummary> modelSummary, QWidget
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
|
||||
/// monthly need
|
||||
QHBoxLayout* footerLayout = new QHBoxLayout();
|
||||
QHBoxLayout* footerLayout = new QHBoxLayout();
|
||||
|
||||
QLabel* nTotalSharesLabel = new QLabel("Erwartete Ernteanteile:");
|
||||
const qreal expectedShares = m_modelSummary->nTotalExpectedShares();
|
||||
m_nTotalExpectedShares = new QLabel(QString::number(expectedShares));
|
||||
|
||||
QLabel* financialNeedLabel = new QLabel("monatlicher Finanzbedarf:");
|
||||
m_financialNeedBox = new QSpinBox();
|
||||
m_financialNeedBox->setMaximum(50000);
|
||||
m_financialNeedBox->setValue(m_financialNeed);
|
||||
|
||||
connect(m_financialNeedBox, &QSpinBox::valueChanged, this,
|
||||
&SummaryWidget::onFinancialNeedChanged);
|
||||
|
||||
footerLayout->addWidget(nTotalSharesLabel);
|
||||
footerLayout->addWidget(m_nTotalExpectedShares);
|
||||
footerLayout->addStretch(1);
|
||||
footerLayout->addWidget(financialNeedLabel);
|
||||
footerLayout->addWidget(m_financialNeedBox);
|
||||
footerLayout->addStretch(1);
|
||||
@ -50,6 +59,11 @@ void SummaryWidget::onNExpectedBiddingChanged(int newNExpected) {
|
||||
m_biddingStatus3->onExpectedBiddingsChanged(newNExpected);
|
||||
}
|
||||
|
||||
void SummaryWidget::onNTotalExpectedSharesChanged(qreal newNExpected) {
|
||||
const QString expectedSharesString = QString::number(newNExpected);
|
||||
m_nTotalExpectedShares->setText(expectedSharesString);
|
||||
}
|
||||
|
||||
void SummaryWidget::onNPlacedBiddingsChanged(const int roundNumber) {
|
||||
switch (roundNumber) {
|
||||
case 1:
|
||||
@ -140,6 +154,9 @@ void SummaryWidget::setupConnections() {
|
||||
// "bindProperty(&bindable, &signal, &getter, widget)"
|
||||
QObject::connect(m_modelSummary.get(), &ModelSummary::nExpectedBiddingsChanged,
|
||||
[&]() { onNExpectedBiddingChanged(m_modelSummary->nExpectedBiddings()); });
|
||||
QObject::connect(m_modelSummary.get(), &ModelSummary::nTotalExpectedSharesChanged, this, [&]() {
|
||||
onNTotalExpectedSharesChanged(m_modelSummary->nTotalExpectedShares());
|
||||
});
|
||||
QObject::connect(m_modelSummary.get(), &ModelSummary::nPlacedBiddingsChanged, this,
|
||||
&SummaryWidget::onNPlacedBiddingsChanged);
|
||||
QObject::connect(m_modelSummary.get(), &ModelSummary::biddingSumChanged, this,
|
||||
|
||||
@ -18,6 +18,7 @@ class SummaryWidget : public QWidget {
|
||||
private slots:
|
||||
void onFinancialNeedChanged(int newFinancialNeed);
|
||||
void onNExpectedBiddingChanged(int newNExpected);
|
||||
void onNTotalExpectedSharesChanged(qreal newNExpected);
|
||||
|
||||
void onNPlacedBiddingsChanged(const int roundNumber);
|
||||
void onBiddingSumChanged(const int roundNumber);
|
||||
@ -31,8 +32,9 @@ class SummaryWidget : public QWidget {
|
||||
std::unique_ptr<BiddingRoundStatusWidget> m_biddingStatus3;
|
||||
|
||||
// TODO read from settings (maybe via model/core; maybe set in constructor)
|
||||
const int m_financialNeed = 13942;
|
||||
QSpinBox* m_financialNeedBox = nullptr;
|
||||
const int m_financialNeed = 13942;
|
||||
QSpinBox* m_financialNeedBox = nullptr;
|
||||
QLabel* m_nTotalExpectedShares = nullptr;
|
||||
|
||||
QLabel* m_rowCountValueLabel;
|
||||
QLabel* m_nExpectedBiddingsValueLabel;
|
||||
|
||||
Reference in New Issue
Block a user