forked from kimmoli/paint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShaderModel.h
44 lines (33 loc) · 967 Bytes
/
ShaderModel.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
37
38
39
40
41
42
43
44
#ifndef SHADERMODEL_H
#define SHADERMODEL_H
#include <QAbstractListModel>
#include <QObject>
#include "ShaderItem.h"
class ShaderModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
enum ShaderRoles
{
ObjectRole = Qt::UserRole+1,
NameRole,
FragmentShaderRole,
VertexShaderRole,
ParametersRole
};
int count() const;
ShaderModel(QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
Q_INVOKABLE QVariant get(const quint32 &shaderId) const;
signals:
void countChanged();
protected:
QHash<int, QByteArray> roleNames() const;
private:
QList<ShaderItem *> _shaders;
QString readFile(QString filename);
};
Q_DECLARE_METATYPE(ShaderModel *)
#endif // ShaderMODEL_H