-
Notifications
You must be signed in to change notification settings - Fork 948
Expand file tree
/
Copy pathNode.hpp
More file actions
121 lines (81 loc) · 1.99 KB
/
Node.hpp
File metadata and controls
121 lines (81 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#pragma once
#include <QtCore/QObject>
#include <QtCore/QUuid>
#include <QtCore/QJsonObject>
#include "PortType.hpp"
#include "Export.hpp"
#include "NodeState.hpp"
#include "NodeGeometry.hpp"
#include "NodeData.hpp"
#include "NodeGraphicsObject.hpp"
#include "ConnectionGraphicsObject.hpp"
#include "Serializable.hpp"
#include "memory.hpp"
namespace QtNodes
{
class Connection;
class ConnectionState;
class NodeGraphicsObject;
class NodeDataModel;
class NODE_EDITOR_PUBLIC Node
: public QObject
, public Serializable
{
Q_OBJECT
public:
/// NodeDataModel should be an rvalue and is moved into the Node
Node(std::unique_ptr<NodeDataModel> && dataModel);
virtual
~Node();
public:
QJsonObject
save() const override;
void
restore(QJsonObject const &json) override;
public:
QUuid
id() const;
void reactToPossibleConnection(PortType,
NodeDataType const &,
QPointF const & scenePoint);
void
resetReactionToConnection();
public:
NodeGraphicsObject const &
nodeGraphicsObject() const;
NodeGraphicsObject &
nodeGraphicsObject();
void
setGraphicsObject(std::unique_ptr<NodeGraphicsObject>&& graphics);
NodeGeometry&
nodeGeometry();
NodeGeometry const&
nodeGeometry() const;
NodeState const &
nodeState() const;
NodeState &
nodeState();
NodeDataModel*
nodeDataModel() const;
public Q_SLOTS: // data propagation
/// Propagates incoming data to the underlying model.
void
propagateData(PortIndex inPortIndex) const;
/// Fetches data from model's OUT #index port
/// and propagates it to the connection
void
onDataUpdated(PortIndex index);
/// update the graphic part if the size of the embeddedwidget changes
void
onNodeSizeUpdated();
private:
// addressing
QUuid _uid;
// data
std::unique_ptr<NodeDataModel> _nodeDataModel;
NodeState _nodeState;
// painting
NodeGeometry _nodeGeometry;
std::unique_ptr<NodeGraphicsObject> _nodeGraphicsObject;
};
}