OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
qml_model_property.hpp
1
2#pragma once
3#include <ossia/network/base/parameter.hpp>
4
5#include <ossia-qt/device/qml_node_base.hpp>
6#include <ossia-qt/value_metatypes.hpp>
7
8#include <QAbstractItemModel>
9#include <QObject>
10#include <QQmlProperty>
11#include <QQmlPropertyValueSource>
12
13#include <verdigris>
14namespace ossia
15{
16namespace qt
17{
18class OSSIA_EXPORT qml_model_property : public QAbstractItemModel
19{
20 W_OBJECT(qml_model_property)
21
22public:
23 qml_model_property(QObject* parent = nullptr);
24 ~qml_model_property() override;
25
26public:
27 QModelIndex index(int row, int column, const QModelIndex& parent) const override;
28 QModelIndex parent(const QModelIndex& child) const override;
29 int rowCount(const QModelIndex& parent) const override;
30 int columnCount(const QModelIndex& parent) const override;
31 QVariant data(const QModelIndex& index, int role) const override;
32 int count() const;
33 QString node() const;
34 QObject* parentNode() const;
35 QObject* device() const;
36 auto parentOssiaNode() const { return m_parentOssiaNode; }
37
38 void updateCount();
39 void reloadParentNode();
40
41public:
42 void setValue_sig(const ossia::value& arg_1)
43 E_SIGNAL(OSSIA_EXPORT, setValue_sig, arg_1);
44 void countChanged(int count) E_SIGNAL(OSSIA_EXPORT, countChanged, count);
45 void nodeChanged(QString node) E_SIGNAL(OSSIA_EXPORT, nodeChanged, node);
46 void parentNodeChanged(QObject* parentNode)
47 E_SIGNAL(OSSIA_EXPORT, parentNodeChanged, parentNode);
48 void deviceChanged(QObject* device) E_SIGNAL(OSSIA_EXPORT, deviceChanged, device);
49
50public:
51 void setCount(int count);
52 W_SLOT(setCount);
53 void setNode(const QString& node);
54 W_SLOT(setNode);
55 void setParentNode(QObject* parentNode);
56 W_SLOT(setParentNode);
57 void setDevice(QObject* device);
58 W_SLOT(setDevice);
59
60private:
61 void on_device_deleted(QObject*);
62 void on_node_deleted(const ossia::net::node_base&);
63
64 QString m_node;
65
66 QObject* m_parentNode{};
67 ossia::net::node_base* m_parentOssiaNode{};
68 qml_device* m_device{};
69 int m_count{};
70
71 W_PROPERTY(
72 QObject*, parentNode READ parentNode WRITE setParentNode NOTIFY parentNodeChanged)
73
74 W_PROPERTY(QObject*, device READ device WRITE setDevice NOTIFY deviceChanged)
75
76 W_PROPERTY(QString, node READ node WRITE setNode NOTIFY nodeChanged)
77
78 W_PROPERTY(int, count READ count WRITE setCount NOTIFY countChanged)
79};
80}
81}
The node_base class.
Definition node.hpp:48
The value class.
Definition value.hpp:173
Definition git_info.h:7