2018-05-24 18:35:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CheckableTest.h"
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
|
|
|
|
class CheckableTestModel : public QAbstractTableModel
|
|
|
|
{
|
2019-10-05 14:14:45 +00:00
|
|
|
Q_OBJECT
|
2018-05-24 18:35:16 +00:00
|
|
|
|
|
|
|
protected:
|
2019-10-05 14:14:45 +00:00
|
|
|
QString m_title;
|
|
|
|
CheckableTests m_tests;
|
2018-05-24 18:35:16 +00:00
|
|
|
|
|
|
|
public:
|
2019-10-05 14:14:45 +00:00
|
|
|
CheckableTestModel(QObject* parent);
|
2018-05-24 18:35:16 +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-05-24 18:35:16 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
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;
|
2018-05-24 18:35:16 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation,
|
|
|
|
int role = Qt::DisplayRole) const override;
|
2018-05-24 18:35:16 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
unsigned int getPoints() const;
|
2018-06-15 15:53:43 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
QString getTitle() const;
|
2019-02-03 18:53:51 +00:00
|
|
|
|
2018-11-17 00:19:03 +00:00
|
|
|
protected:
|
2019-10-05 14:14:45 +00:00
|
|
|
virtual bool isValidIndex(const QModelIndex& index) const;
|
2018-05-24 18:35:16 +00:00
|
|
|
|
2018-11-17 00:19:03 +00:00
|
|
|
private:
|
2019-10-05 14:14:45 +00:00
|
|
|
CheckableItems& getItems(const QModelIndex& index);
|
|
|
|
const CheckableItems& getItems(const QModelIndex& index) const;
|
2018-05-24 18:35:16 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
CheckableItem& getItem(const QModelIndex& index);
|
|
|
|
const CheckableItem& getItem(const QModelIndex& index) const;
|
2018-05-24 18:35:16 +00:00
|
|
|
};
|