This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
ESGRAF48/source/ResultWidget/ResultModel.h

79 lines
1.6 KiB
C
Raw Normal View History

2018-06-06 16:05:30 +00:00
#pragma once
#include "Age.h"
2019-02-07 21:36:39 +00:00
2018-06-06 16:05:30 +00:00
#include <QAbstractTableModel>
2019-02-07 21:36:39 +00:00
#include <QPainter>
2018-06-06 16:05:30 +00:00
class TestResult
{
private:
2019-10-05 14:14:45 +00:00
QString m_name;
size_t m_points = 0;
size_t m_pr = 0;
2018-06-06 16:05:30 +00:00
public:
2019-10-05 14:14:45 +00:00
TestResult(const char* name)
: m_name(name)
{
}
void setPoints(const size_t& points)
{
m_points = points;
}
void setPR(const unsigned int& pr)
{
m_pr = pr;
}
const QString& name() const
{
return m_name;
}
const size_t points() const
{
return m_points;
}
const size_t pr() const
{
return m_pr;
}
2018-06-06 16:05:30 +00:00
};
class ResultModel : public QAbstractTableModel
{
2019-10-05 14:14:45 +00:00
Q_OBJECT
2018-06-06 16:05:30 +00:00
private:
2019-10-05 14:14:45 +00:00
Age m_age;
std::vector<TestResult> m_results;
2018-06-06 16:05:30 +00:00
public:
2019-10-05 14:14:45 +00:00
ResultModel(QObject* parent);
2018-06-06 16:05:30 +00:00
2019-10-05 14:14:45 +00:00
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
2018-06-06 16:05:30 +00:00
2019-10-05 14:14:45 +00:00
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
2018-06-06 16:05:30 +00:00
2019-10-05 14:14:45 +00:00
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
2019-10-05 14:14:45 +00:00
void setAge(const Age& age);
void setPluralResult(unsigned int points);
void setGenusResult(unsigned int points);
void setVerbEndResult(unsigned int points);
void setAkkusativResult(unsigned int points);
void setDativResult(unsigned int points);
void setV2Result(unsigned int points);
void setSvkResult(unsigned int points);
2018-06-26 14:59:51 +00:00
void setPassivResult(unsigned int points);
void setGenitivResult(unsigned int points);
2019-02-07 21:36:39 +00:00
2019-10-05 14:14:45 +00:00
void printTo(QPainter& painter) const;
2018-06-06 16:05:30 +00:00
};