swissChili | 4b3105a | 2022-02-22 16:34:39 -0800 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include <QObject> |
| 4 | #include <qqml.h> |
| 5 | |
| 6 | class Cell : public QObject |
| 7 | { |
| 8 | Q_OBJECT |
| 9 | QML_ELEMENT |
| 10 | |
| 11 | Q_PROPERTY(QString code READ code WRITE setCode NOTIFY codeChanged) |
| 12 | Q_PROPERTY(QString result READ result WRITE setResult NOTIFY resultChanged) |
| 13 | |
| 14 | public: |
| 15 | explicit Cell(QObject *parent = nullptr); |
| 16 | Cell(const Cell ©, QObject *parent = nullptr); |
| 17 | Cell(QString code, QString result, QObject *parent = nullptr); |
| 18 | |
| 19 | Cell &operator =(const Cell ©); |
| 20 | |
| 21 | QString code() const; |
| 22 | QString result() const; |
| 23 | |
| 24 | void setCode(QString code); |
| 25 | void setResult(QString result); |
| 26 | |
| 27 | signals: |
| 28 | void codeChanged(QString code); |
| 29 | void resultChanged(QString result); |
| 30 | |
| 31 | private: |
| 32 | QString _code, _result; |
| 33 | }; |
| 34 | |
| 35 | Q_DECLARE_METATYPE(Cell) |