/
datamodel.h
36 lines (26 loc) · 825 Bytes
/
datamodel.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
36
#ifndef DATAMODEL_H
#define DATAMODEL_H
#include <QAbstractListModel>
#include "searchworker.h"
class SearchWorker;
class DataModel : public QAbstractListModel
{
Q_OBJECT
public:
DataModel(QStringList lines, QObject *parent = 0);
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
void search(QString query);
QString getRawData(int row);
signals:
void searchFinished();
public slots:
void onSearchFinished();
void onRowAdded();
private:
QStringList _m_Lines, _m_Results;
SearchWorker _m_SearchWorker;
};
#endif // DATAMODEL_H