-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathField.hpp
More file actions
40 lines (28 loc) · 741 Bytes
/
Field.hpp
File metadata and controls
40 lines (28 loc) · 741 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
39
40
#ifndef FIELD_HPP
#define FIELD_HPP
#include <QObject>
#include <QVector>
class Cell;
class Field : public QObject
{
Q_OBJECT
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
public:
explicit Field(QObject *parent = 0);
int width() const { return m_width; }
int height() const { return m_height; }
Q_INVOKABLE Cell *cellAt(int x, int y);
signals:
void widthChanged(int width);
void heightChanged(int height);
public slots:
void setWidth(int width);
void setHeight(int height);
private:
void applySize();
QVector<Cell*> m_cells;
int m_width;
int m_height;
};
#endif // FIELD_HPP