Added a placeholder for the configuration of the monthly financial need.

This commit is contained in:
2026-02-16 11:46:01 +01:00
parent f200fff99e
commit f8201ead71
2 changed files with 36 additions and 7 deletions

View File

@ -2,6 +2,7 @@
#include <QLabel> #include <QLabel>
#include <QProperty> #include <QProperty>
#include <QSpinBox>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <model/modelsummary.h> #include <model/modelsummary.h>
@ -11,12 +12,13 @@ SummaryWidget::SummaryWidget(std::shared_ptr<ModelSummary> modelSummary, QWidget
, m_modelSummary(modelSummary) { , m_modelSummary(modelSummary) {
/// Layouting /// Layouting
QVBoxLayout* mainLayout = new QVBoxLayout(this); QVBoxLayout* mainLayout = new QVBoxLayout(this);
QHBoxLayout* headerLayout = new QHBoxLayout();
QHBoxLayout* rowCountLayout = new QHBoxLayout(); /// bindable (proof of concept) properties
QLabel* rowCountLabel = new QLabel("Row count:"); QLabel* rowCountLabel = new QLabel("Row count:");
m_rowCountValueLabel = new QLabel(""); m_rowCountValueLabel = new QLabel("");
rowCountLayout->addWidget(rowCountLabel); headerLayout->addWidget(rowCountLabel);
rowCountLayout->addWidget(m_rowCountValueLabel); headerLayout->addWidget(m_rowCountValueLabel);
QHBoxLayout* nExpectedBiddingsLayout = new QHBoxLayout(); QHBoxLayout* nExpectedBiddingsLayout = new QHBoxLayout();
QLabel* nExpectedBiddingsLabel = new QLabel("Expected biddings:"); QLabel* nExpectedBiddingsLabel = new QLabel("Expected biddings:");
@ -24,14 +26,33 @@ SummaryWidget::SummaryWidget(std::shared_ptr<ModelSummary> modelSummary, QWidget
nExpectedBiddingsLayout->addWidget(nExpectedBiddingsLabel); nExpectedBiddingsLayout->addWidget(nExpectedBiddingsLabel);
nExpectedBiddingsLayout->addWidget(m_nExpectedBiddingsValueLabel); 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(nExpectedBiddingsLayout);
mainLayout->addLayout(footerLayout);
setLayout(mainLayout); setLayout(mainLayout);
setupBindableProperties(); setupBindableProperties();
} }
void SummaryWidget::onFinancialNeedChanged(int newFinancialNeed) {
// NEXT implement reaction on financial need changes
qCritical() << "Apply financial need changes!!!";
}
void SummaryWidget::setupBindableProperties() { void SummaryWidget::setupBindableProperties() {
// TODO figure out how to encapsulate each property binding into a dedicated function: // TODO figure out how to encapsulate each property binding into a dedicated function:
// "bindProperty(&bindable, &signal, &getter, widget)" // "bindProperty(&bindable, &signal, &getter, widget)"

View File

@ -5,6 +5,7 @@
class ModelSummary; class ModelSummary;
class QLabel; class QLabel;
class QSpinBox;
class SummaryWidget : public QWidget { class SummaryWidget : public QWidget {
Q_OBJECT Q_OBJECT
@ -12,9 +13,16 @@ class SummaryWidget : public QWidget {
public: public:
explicit SummaryWidget(std::shared_ptr<ModelSummary> modelSummary, QWidget* parent = nullptr); explicit SummaryWidget(std::shared_ptr<ModelSummary> modelSummary, QWidget* parent = nullptr);
private slots:
void onFinancialNeedChanged(int newFinancialNeed);
private: private:
std::shared_ptr<ModelSummary> m_modelSummary; std::shared_ptr<ModelSummary> 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_rowCountValueLabel;
QLabel* m_nExpectedBiddingsValueLabel; QLabel* m_nExpectedBiddingsValueLabel;