-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscorecheckerviewmodel.h
35 lines (35 loc) · 1.5 KB
/
scorecheckerviewmodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef MYSCORINGMODEL_H
#define MYSCORINGMODEL_H
#include <QAbstractTableModel>
#include <QStandardItemModel>
#include <vector>
#include "pathexistscorechecker.h"
#include "runcommandscorechecker.h"
#include "valuescorechecker.h"
#include "scriptscorechecker.h"
#include "questionanswerscorechecker.h"
#include "templatescorechecker.h"
#include "constants.h"
class ScoreCheckerViewModel : public QAbstractTableModel //QStandardItemModel //
{
Q_OBJECT
public:
ScoreCheckerViewModel(QObject *parent, std::vector<BaseScoreChecker*> *vecScoreCheckers );
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) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
Qt::ItemFlags flags(const QModelIndex &index) const;
void sort(int column, Qt::SortOrder order);
void refresh(int column);
void insertChecker(BaseScoreChecker *checker);
void removeCheckers(QModelIndexList indexlist);
private:
std::vector<BaseScoreChecker*> *vecScoreCheckers;
};
bool sortByType(BaseScoreChecker* a, BaseScoreChecker* b);
bool sortByDescription(BaseScoreChecker* a, BaseScoreChecker* b);
bool sortByPoints(BaseScoreChecker* a, BaseScoreChecker* b);
bool sortBySolved(BaseScoreChecker* a, BaseScoreChecker* b);
#endif // MYSCORINGMODEL_H