38 lines
855 B
C
38 lines
855 B
C
|
#ifndef FILTERMODEL_H
|
||
|
#define FILTERMODEL_H
|
||
|
|
||
|
#include <QAbstractListModel>
|
||
|
#include <QtDebug>
|
||
|
#include "serverconn.h"
|
||
|
|
||
|
class FilterModel : public QAbstractListModel
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
explicit FilterModel(QObject *parent = nullptr);
|
||
|
|
||
|
enum FilterRole {
|
||
|
GradeRole = Qt::DisplayRole,
|
||
|
ClassLetterRole
|
||
|
};
|
||
|
Q_ENUM(FilterRole)
|
||
|
|
||
|
int rowCount(const QModelIndex & = QModelIndex()) const;
|
||
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||
|
QHash<int, QByteArray> roleNames() const;
|
||
|
|
||
|
Q_INVOKABLE QVariantMap get(int row) const;
|
||
|
Q_INVOKABLE void append(const QString &grade, const QString &classLetter);
|
||
|
Q_INVOKABLE void remove(int row);
|
||
|
|
||
|
private:
|
||
|
struct Filter {
|
||
|
QString grade;
|
||
|
QString classLetter;
|
||
|
};
|
||
|
|
||
|
QList<Filter> m_filters;
|
||
|
};
|
||
|
|
||
|
#endif // FILTERMODEL_H
|