Added a placeholder for the configuration of the monthly financial need.
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QLabel>
|
||||
#include <QProperty>
|
||||
#include <QSpinBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <model/modelsummary.h>
|
||||
@ -10,13 +11,14 @@ SummaryWidget::SummaryWidget(std::shared_ptr<ModelSummary> 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> 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)"
|
||||
|
||||
@ -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> modelSummary, QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void onFinancialNeedChanged(int newFinancialNeed);
|
||||
|
||||
private:
|
||||
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_nExpectedBiddingsValueLabel;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user