Added a ModelSummary class to make the overview over the model content accessible via QProperty system & a SummaryWidget to show this information. Only property rowCount as a proof of concept. Other properties will follow.
This commit is contained in:
32
libs/BeetRoundCore/model/modelsummary.h
Normal file
32
libs/BeetRoundCore/model/modelsummary.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef MODELSUMMARY_H
|
||||
#define MODELSUMMARY_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QProperty>
|
||||
|
||||
class TableModel;
|
||||
|
||||
using namespace std;
|
||||
|
||||
class ModelSummary : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged BINDABLE bindableRowCount)
|
||||
|
||||
public:
|
||||
ModelSummary(shared_ptr<TableModel> model, QObject* parent = nullptr);
|
||||
~ModelSummary();
|
||||
|
||||
int rowCount() const;
|
||||
QBindable<int> bindableRowCount();
|
||||
|
||||
signals:
|
||||
void rowCountChanged();
|
||||
|
||||
private:
|
||||
shared_ptr<TableModel> m_model;
|
||||
|
||||
Q_OBJECT_BINDABLE_PROPERTY(ModelSummary, int, m_rowCount, &ModelSummary::rowCountChanged);
|
||||
};
|
||||
|
||||
#endif // MODELSUMMARY_H
|
||||
Reference in New Issue
Block a user