24 lines
914 B
C++
24 lines
914 B
C++
#pragma once
|
|
#include "ParticipantRepo.h"
|
|
#include "QuestionRepo.h"
|
|
#include <qabstractitemmodel.h>
|
|
#include <QVariant>
|
|
#include <QModelIndex>
|
|
#include <unordered_set>
|
|
|
|
class ParticipantModel : public QAbstractTableModel
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
ParticipantRepo& repo;
|
|
QuestionRepo& qrepo;
|
|
std::unordered_set<int> answered;
|
|
public:
|
|
ParticipantModel(ParticipantRepo& repo, QuestionRepo& qrepo, QObject* parent = nullptr);
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
|
void answerQuestion(const int index, const std::string& answer);
|
|
|
|
}; |