ESGRAF48/source/CheckableTestModel/CheckableTestModel.h

42 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#include "CheckableTest.h"
#include <QAbstractTableModel>
class CheckableTestModel : public QAbstractTableModel
{
Q_OBJECT
protected:
2019-02-03 18:53:51 +00:00
QString m_title;
CheckableTests m_tests;
public:
CheckableTestModel(QObject *parent);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
2019-02-03 18:53:51 +00:00
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
2019-02-03 18:53:51 +00:00
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
QVariant headerData(int section, Qt::Orientation orientation,
2019-02-03 18:53:51 +00:00
int role = Qt::DisplayRole) const override;
2018-06-15 15:53:43 +00:00
unsigned int getPoints() const;
2019-02-03 18:53:51 +00:00
QString getTitle() const;
protected:
virtual bool isValidIndex(const QModelIndex &index) const;
private:
CheckableItems &getItems(const QModelIndex &index);
const CheckableItems &getItems(const QModelIndex &index) const;
CheckableItem &getItem(const QModelIndex &index);
const CheckableItem &getItem(const QModelIndex &index) const;
};