enumtype.h
Go to the documentation of this file.
1 #ifndef DNAI_MODELS_DECLARABLE_ENUMTYPE_H
2 #define DNAI_MODELS_DECLARABLE_ENUMTYPE_H
3 
5 #include "entity.h"
6 #include <QObject>
7 
8 namespace dnai
9 {
10  namespace models
11  {
12  namespace gui
13  {
14  namespace declarable
15  {
16  class EnumType : public QObject, public Entity<data::EnumType, EnumType>
17  {
18  Q_OBJECT
19  Q_PROPERTY(QStringList values READ values NOTIFY valuesChanged)
20  public:
21  explicit EnumType(QObject *parent = nullptr);
22  const QStringList &values() const;
23  Q_INVOKABLE void moveUp(int initial);
24  Q_INVOKABLE void moveDown(int initial);
25  Q_INVOKABLE void addEntry(const QString &entry, const QString &value);
26  Q_INVOKABLE void deleteEntry(const QString &entry);
27 
28  //Implementation of ISerializable
29  void serialize(QJsonObject& obj) const override;
30 
31  QString getValue(QString const &name) const;
32 
33  signals:
34  void valuesChanged(const QStringList &val);
35 
36  protected:
37  virtual void _deserialize(const QJsonObject& obj) override;
38  };
39  }
40  }
41  }
42 }
43 
44 #endif //DNAI_MODELS_DECLARABLE_CONTEXT_H
void serialize(QJsonObject &obj) const override
Implement this function to serialize into QJsonObject.
Definition: enumtype.cpp:59
Q_INVOKABLE void moveUp(int initial)
Definition: enumtype.cpp:23
const QStringList & values() const
Q_INVOKABLE void moveDown(int initial)
Definition: enumtype.cpp:49
void valuesChanged(const QStringList &val)
Definition: moc_enumtype.cpp:189
Definition: api.h:13
EnumType(QObject *parent=nullptr)
Definition: enumtype.cpp:13
Q_INVOKABLE void deleteEntry(const QString &entry)
Definition: enumtype.cpp:42
virtual void _deserialize(const QJsonObject &obj) override
Implement this function in order to use deserialize(const QJsonObject &obj)
Definition: enumtype.cpp:80
QString getValue(QString const &name) const
Definition: enumtype.cpp:75
Q_INVOKABLE void addEntry(const QString &entry, const QString &value)
Definition: enumtype.cpp:33