OSSIA
Open Scenario System for Interactive Application
qt_property_node.hpp
1 #pragma once
2 #include <ossia/network/base/protocol.hpp>
3 #include <ossia/network/generic/generic_device.hpp>
4 #include <ossia/network/generic/generic_node.hpp>
5 #include <ossia/network/generic/generic_parameter.hpp>
6 
7 #include <ossia-qt/js_utilities.hpp>
8 
9 #include <QMetaObject>
10 #include <QMetaProperty>
11 #include <QObject>
12 #include <QtQml/QQmlProperty>
13 
14 #include <verdigris>
15 
16 namespace ossia
17 {
18 namespace qt
19 {
20 class OSSIA_EXPORT qt_property_node final
21  : public QObject
22  , public ossia::net::generic_node_base
24 {
25  W_OBJECT(qt_property_node)
26 public:
27  qt_property_node(
28  QObject& obj, QMetaProperty p, ossia::net::device_base& aDevice,
29  node_base& aParent);
30 
31  ossia::value set_value_quiet(const ossia::value&) final override;
32  ossia::value set_value_quiet(ossia::value&&) final override;
33  ossia::net::parameter_base* get_parameter() const final override;
34  ossia::net::parameter_base* create_parameter(ossia::val_type type) final override;
35  bool remove_parameter() final override;
36 
37  template <typename T>
38  void qtValueChanged(const T& val)
39  {
41 
42  m_protocol.push(*this);
43  }
44 
45 private:
46  void qtBoolValueChanged(bool v) { qtValueChanged(v); };
47  W_SLOT(qtBoolValueChanged)
48  void qtTimeValueChanged(QTime v) { qtValueChanged(v); };
49  W_SLOT(qtTimeValueChanged)
50  void qtIntValueChanged(int v) { qtValueChanged(v); };
51  W_SLOT(qtIntValueChanged)
52  void qtUIntValueChanged(quint32 v) { qtValueChanged(v); };
53  W_SLOT(qtUIntValueChanged)
54  void qtULongLongValueChanged(qulonglong v) { qtValueChanged(v); };
55  W_SLOT(qtULongLongValueChanged)
56  void qtCharValueChanged(QChar v) { qtValueChanged(v); };
57  W_SLOT(qtCharValueChanged)
58  void qtStringValueChanged(QString v) { qtValueChanged(v); };
59  W_SLOT(qtStringValueChanged)
60  void qtByteArrayValueChanged(QByteArray v) { qtValueChanged(v); };
61  W_SLOT(qtByteArrayValueChanged)
62  void qtDoubleValueChanged(double v) { qtValueChanged(v); };
63  W_SLOT(qtDoubleValueChanged)
64  void qtColorValueChanged(QColor v) { qtValueChanged(v); };
65  W_SLOT(qtColorValueChanged)
66  void qtPointValueChanged(QPoint v) { qtValueChanged(v); };
67  W_SLOT(qtPointValueChanged)
68  void qtPointFValueChanged(QPointF v) { qtValueChanged(v); };
69  W_SLOT(qtPointFValueChanged)
70  void qtVector2DValueChanged(QVector2D v) { qtValueChanged(v); };
71  W_SLOT(qtVector2DValueChanged)
72  void qtVector3DValueChanged(QVector3D v) { qtValueChanged(v); };
73  W_SLOT(qtVector3DValueChanged)
74  void qtVector4DValueChanged(QVector4D v) { qtValueChanged(v); };
75  W_SLOT(qtVector4DValueChanged)
76  void qtQuaternionValueChanged(QQuaternion v) { qtValueChanged(v); };
77  W_SLOT(qtQuaternionValueChanged)
78  void qtLineValueChanged(QLine v) { qtValueChanged(v); };
79  W_SLOT(qtLineValueChanged)
80  void qtLineFValueChanged(QLineF v) { qtValueChanged(v); };
81  W_SLOT(qtLineFValueChanged)
82  void qtRectValueChanged(QRectF v) { qtValueChanged(v); };
83  W_SLOT(qtRectValueChanged)
84  void qtRectFValueChanged(QRectF v) { qtValueChanged(v); };
85  W_SLOT(qtRectFValueChanged)
86  void qtSizeValueChanged(QSize v) { qtValueChanged(v); };
87  W_SLOT(qtSizeValueChanged)
88  void qtSizeFValueChanged(QSizeF v) { qtValueChanged(v); };
89  W_SLOT(qtSizeFValueChanged)
90  void qtListValueChanged(QVariantList v) { qtValueChanged(v); };
91  W_SLOT(qtListValueChanged)
92  void qtStringListValueChanged(QStringList v) { qtValueChanged(v); };
93  W_SLOT(qtStringListValueChanged)
94  void qtDateValueChanged(QDate v) { qtValueChanged(v); };
95  W_SLOT(qtDateValueChanged)
96 
97  void qtImpulse() { m_protocol.push(*this); };
98  W_SLOT(qtImpulse)
99 
100  void setValue_slot(const ossia::value&);
101  W_SLOT(setValue_slot);
102 
103 public:
104  void setValue_sig(const ossia::value& arg_1)
105  E_SIGNAL(OSSIA_EXPORT, setValue_sig, arg_1);
106 
107 private:
108  std::unique_ptr<node_base> make_child(const std::string& name) final override;
109  void removing_child(node_base&) final override;
110 
111  QObject& m_obj;
112  QMetaProperty m_prop;
113 };
114 }
115 }
Root of a device tree.
Definition: ossia/network/base/device.hpp:58
Definition: generic_parameter.hpp:24
ossia::value set_value_quiet(const ossia::value &) override
Definition: generic_parameter.cpp:160
The value class.
Definition: value.hpp:173
Definition: git_info.h:7
val_type
Enum to represent the types that a value can take.
Definition: parameter_properties.hpp:16