-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.h
44 lines (32 loc) · 876 Bytes
/
controller.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 CONTROLLER_H
#define CONTROLLER_H
#include <QObject>
#include <QMutex>
class FlyData;
class FlyModel;
class QAbstractItemModel;
class Controller : public QObject
{
Q_OBJECT
Q_PROPERTY(int size MEMBER mSize WRITE setSize NOTIFY sizeChanged)
Q_PROPERTY(int capacity MEMBER mCapacity WRITE setCapacity NOTIFY capacityChanged)
Q_PROPERTY(QAbstractItemModel* model READ model CONSTANT)
signals:
void sizeChanged(int);
void capacityChanged(int);
public:
explicit Controller(QObject *parent = 0);
Q_INVOKABLE void addFly(const QPoint&);
private slots:
void setSize(int);
void setCapacity(int);
void onFlyTryMove(FlyData&);
private:
bool isCellAvailable(const QPoint&) const;
QAbstractItemModel* model() const;
int mSize;
int mCapacity;
FlyModel* mModel;
QMutex mMutex;
};
#endif // CONTROLLER_H