variable.h
Go to the documentation of this file.
1 #ifndef DNAI_MODELS_DECLARABLE_VARIABLE_H
2 #define DNAI_MODELS_DECLARABLE_VARIABLE_H
3 
4 #include <QObject>
8 #include <QAbstractListModel>
9 
10 namespace dnai
11 {
12  namespace models
13  {
14  namespace gui
15  {
16  class EntityList;
17  namespace declarable
18  {
19  class Variable : public QObject, public interfaces::IVariable, public Entity<data::Variable, Variable>
20  {
21  Q_OBJECT
22  Q_PROPERTY(QUuid varType READ varType WRITE setVarType NOTIFY varTypeChanged)
23  Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged)
24 
25  public:
26  explicit Variable(QObject *parent = nullptr);
27  //Implementation of ISerializable
28  void serialize(QJsonObject& obj) const override;
29  protected:
30  void _deserialize(const QJsonObject& obj) override;
31  public:
32  QUuid varType() const override;
33  bool setVarType(QUuid const &id) override;
34  const QString &value() const override;
35  bool setValue(const QString& value) override;
36 
37  static EntityList *variables();
38 
39  signals:
40  void varTypeChanged(QUuid id);
41  void valueChanged(const QString &variant);
42 
43  private:
45  };
46  }
47  }
48  }
49 }
50 
51 #endif //DNAI_MODELS_DECLARABLE_VARIABLE_H
const QString & value() const override
bool setVarType(QUuid const &id) override
Definition: variable.cpp:40
Definition: entitylist.h:13
void varTypeChanged(QUuid id)
Definition: moc_variable.cpp:191
static EntityList * m_variables
Definition: variable.h:44
static EntityList * variables()
Definition: variable.cpp:64
Definition: ivariable.h:13
void _deserialize(const QJsonObject &obj) override
Implement this function in order to use deserialize(const QJsonObject &obj)
Definition: variable.cpp:28
void valueChanged(const QString &variant)
Definition: moc_variable.cpp:198
bool setValue(const QString &value) override
Definition: variable.cpp:55
void serialize(QJsonObject &obj) const override
Implement this function to serialize into QJsonObject.
Definition: variable.cpp:21
Definition: api.h:13