forked from l3enQ/nodeeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodeDelegateModel.cpp
More file actions
54 lines (42 loc) · 1018 Bytes
/
NodeDelegateModel.cpp
File metadata and controls
54 lines (42 loc) · 1018 Bytes
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
#include "NodeDelegateModel.hpp"
#include "StyleCollection.hpp"
namespace QtNodes {
NodeDelegateModel::NodeDelegateModel()
: _nodeStyle(StyleCollection::nodeStyle())
{
// Derived classes can initialize specific style here
}
QJsonObject NodeDelegateModel::save() const
{
QJsonObject modelJson;
modelJson["model-name"] = name();
return modelJson;
}
void NodeDelegateModel::load(QJsonObject const &)
{
//
}
ConnectionPolicy NodeDelegateModel::portConnectionPolicy(PortType portType, PortIndex) const
{
auto result = ConnectionPolicy::One;
switch (portType) {
case PortType::In:
result = ConnectionPolicy::One;
break;
case PortType::Out:
result = ConnectionPolicy::Many;
break;
case PortType::None:
break;
}
return result;
}
NodeStyle const &NodeDelegateModel::nodeStyle() const
{
return _nodeStyle;
}
void NodeDelegateModel::setNodeStyle(NodeStyle const &style)
{
_nodeStyle = style;
}
} // namespace QtNodes