2018-05-24 18:35:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CheckableTest.h"
|
|
|
|
#include <QAbstractTableModel>
|
2018-12-08 20:02:35 +00:00
|
|
|
#include <QTextCursor>
|
2018-05-24 18:35:16 +00:00
|
|
|
|
|
|
|
class CheckableTestModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CheckableTests m_tests;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CheckableTestModel(QObject *parent);
|
|
|
|
|
|
|
|
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;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
|
|
bool setData(const QModelIndex &index, const QVariant &value,
|
|
|
|
int role = Qt::EditRole) override;
|
|
|
|
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation,
|
|
|
|
int role = Qt::DisplayRole) const override;
|
|
|
|
|
2018-06-15 15:53:43 +00:00
|
|
|
unsigned int getPoints() const;
|
|
|
|
|
2018-12-08 20:02:35 +00:00
|
|
|
virtual void printTo(QTextCursor &cursor) const;
|
|
|
|
|
2018-11-17 00:19:03 +00:00
|
|
|
protected:
|
|
|
|
virtual bool isValidIndex(const QModelIndex &index) const;
|
2018-05-24 18:35:16 +00:00
|
|
|
|
2018-12-08 20:02:35 +00:00
|
|
|
virtual std::string getName() const = 0;
|
|
|
|
void printTableTo(QTextCursor &cursor) const;
|
|
|
|
void printSummaryTo(QTextCursor &cursor) const;
|
|
|
|
|
2018-11-17 00:19:03 +00:00
|
|
|
private:
|
2018-05-24 18:35:16 +00:00
|
|
|
CheckableItems &getItems(const QModelIndex &index);
|
|
|
|
const CheckableItems &getItems(const QModelIndex &index) const;
|
|
|
|
|
|
|
|
CheckableItem &getItem(const QModelIndex &index);
|
|
|
|
const CheckableItem &getItem(const QModelIndex &index) const;
|
|
|
|
};
|
|
|
|
|