-
Notifications
You must be signed in to change notification settings - Fork 0
/
lightlistmodel.h
43 lines (33 loc) · 1.03 KB
/
lightlistmodel.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
/**
* @author Saef Taher
* @date 14/01/2018
*/
#ifndef LIGHTLISTMODEL_H
#define LIGHTLISTMODEL_H
#include "light.h"
#include <vector>
#include <memory>
#include <QAbstractListModel>
#include <QNetworkReply>
class LightListModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit LightListModel(QObject *parent = 0);
// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
virtual std::weak_ptr<Light> lightAt(const QModelIndex &index);
virtual Light lightAt(const QModelIndex &index) const;
virtual void setLight(const QModelIndex &index, Light newLight);
void addAsAmbilight(const QModelIndex &index);
void removeFromAmbilight(const QModelIndex &index);
void setAmbiState(const Light &lightState);
void emitDataChanged(int row);
public slots:
signals:
void fetched();
protected:
virtual void setFetchConnection();
};
#endif // LIGHTLISTMODEL_H