Files
BeetRound/libs/BeetRoundCore/model/modelsummary.cpp

33 lines
978 B
C++

#include "modelsummary.h"
#include "tablemodel.h"
ModelSummary::ModelSummary(std::shared_ptr<TableModel> model, QObject* parent)
: QObject(parent)
, m_model(model) {
Q_ASSERT(model);
connect(m_model.get(), &TableModel::rowCountChanged, this, &ModelSummary::rowCountChanged);
// TODO ? use existing model signals (dataChanged(role),...) instead of special signals
connect(m_model.get(), &TableModel::nExpectedBiddingsChanged, this,
&ModelSummary::nExpectedBiddingsChanged);
}
ModelSummary::~ModelSummary() {}
int ModelSummary::rowCount() const {
const int nRows = m_model->rowCount();
return nRows;
}
QBindable<int> ModelSummary::bindableRowCount() {
m_rowCount = m_model->rowCount();
return &m_rowCount;
}
int ModelSummary::nExpectedBiddings() const { return m_model->nExpectedBiddings(); }
QBindable<int> ModelSummary::bindableNExpectedBiddings() {
m_nExpectedBiddings = m_model->nExpectedBiddings();
return &m_nExpectedBiddings;
}