-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSportQuestionListModel.h
More file actions
38 lines (28 loc) · 910 Bytes
/
Copy pathSportQuestionListModel.h
File metadata and controls
38 lines (28 loc) · 910 Bytes
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
36
37
38
#ifndef SPORTQUESTIONLISTMODEL_H
#define SPORTQUESTIONLISTMODEL_H
#include "SportQuestion.h"
#include <QAbstractListModel>
class SportQuestionListModel : public QAbstractListModel
{
Q_OBJECT
public:
SportQuestionListModel();
enum DataRoles
{
IssueRole = Qt::UserRole + 1,
ChoiceRole,
AnswerRole
};
int rowCount(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 = Qt::DisplayRole) const override;
public slots:
// 接收搜索结果
void receiveSearchResult(const QList<SportQuestion> &questions);
private:
QList<SportQuestion> m_questions;
protected:
QHash<int, QByteArray> roleNames() const override;
};
#endif // SPORTQUESTIONLISTMODEL_H