123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #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
|