diff --git a/UIs/BeetRoundWidgets/widgets/summarywidget.cpp b/UIs/BeetRoundWidgets/widgets/summarywidget.cpp index 66b7ac5..0214c9e 100644 --- a/UIs/BeetRoundWidgets/widgets/summarywidget.cpp +++ b/UIs/BeetRoundWidgets/widgets/summarywidget.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -10,13 +11,14 @@ SummaryWidget::SummaryWidget(std::shared_ptr modelSummary, QWidget : QWidget{parent} , m_modelSummary(modelSummary) { /// Layouting - QVBoxLayout* mainLayout = new QVBoxLayout(this); + QVBoxLayout* mainLayout = new QVBoxLayout(this); + QHBoxLayout* headerLayout = new QHBoxLayout(); - QHBoxLayout* rowCountLayout = new QHBoxLayout(); - QLabel* rowCountLabel = new QLabel("Row count:"); - m_rowCountValueLabel = new QLabel(""); - rowCountLayout->addWidget(rowCountLabel); - rowCountLayout->addWidget(m_rowCountValueLabel); + /// bindable (proof of concept) properties + QLabel* rowCountLabel = new QLabel("Row count:"); + m_rowCountValueLabel = new QLabel(""); + headerLayout->addWidget(rowCountLabel); + headerLayout->addWidget(m_rowCountValueLabel); QHBoxLayout* nExpectedBiddingsLayout = new QHBoxLayout(); QLabel* nExpectedBiddingsLabel = new QLabel("Expected biddings:"); @@ -24,14 +26,33 @@ SummaryWidget::SummaryWidget(std::shared_ptr modelSummary, QWidget nExpectedBiddingsLayout->addWidget(nExpectedBiddingsLabel); nExpectedBiddingsLayout->addWidget(m_nExpectedBiddingsValueLabel); - mainLayout->addLayout(rowCountLayout); + /// monthly need + QHBoxLayout* footerLayout = new QHBoxLayout(); + 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(financialNeedLabel); + footerLayout->addWidget(m_financialNeedBox); + footerLayout->addStretch(1); + + mainLayout->addLayout(headerLayout); mainLayout->addLayout(nExpectedBiddingsLayout); + mainLayout->addLayout(footerLayout); setLayout(mainLayout); setupBindableProperties(); } +void SummaryWidget::onFinancialNeedChanged(int newFinancialNeed) { + // NEXT implement reaction on financial need changes + qCritical() << "Apply financial need changes!!!"; +} + void SummaryWidget::setupBindableProperties() { // TODO figure out how to encapsulate each property binding into a dedicated function: // "bindProperty(&bindable, &signal, &getter, widget)" diff --git a/UIs/BeetRoundWidgets/widgets/summarywidget.h b/UIs/BeetRoundWidgets/widgets/summarywidget.h index 9f17d70..553efdd 100644 --- a/UIs/BeetRoundWidgets/widgets/summarywidget.h +++ b/UIs/BeetRoundWidgets/widgets/summarywidget.h @@ -5,6 +5,7 @@ class ModelSummary; class QLabel; +class QSpinBox; class SummaryWidget : public QWidget { Q_OBJECT @@ -12,9 +13,16 @@ class SummaryWidget : public QWidget { public: explicit SummaryWidget(std::shared_ptr modelSummary, QWidget* parent = nullptr); + private slots: + void onFinancialNeedChanged(int newFinancialNeed); + private: std::shared_ptr m_modelSummary; + // TODO read from settings (maybe via model/core; maybe set in constructor) + const int m_financialNeed = 13942; + QSpinBox* m_financialNeedBox = nullptr; + QLabel* m_rowCountValueLabel; QLabel* m_nExpectedBiddingsValueLabel;