mirror of
https://github.com/arabine/open-story-teller.git
synced 2025-12-07 01:15:14 +01:00
55 lines
1,018 B
C++
55 lines
1,018 B
C++
#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
|