DiagramDesigner/source/nodeDelegateModel.cpp

53 lines
971 B
C++
Raw Normal View History

2024-12-03 20:07:25 +08:00
#include "nodeDelegateModel.h"
#include "styleCollection.h"
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;
}