1 #include "qnstgraphicsport.h"
6 setnstType(Qnst::Port);
11 QnstGraphicsPort::~QnstGraphicsPort()
16 QString QnstGraphicsPort::getComponent()
const
21 void QnstGraphicsPort::setComponent(QString component)
23 this->component = component;
26 QString QnstGraphicsPort::getComponentUid()
const
31 void QnstGraphicsPort::setComponentUid(QString componentUid)
33 this->componentUid = componentUid;
36 QString QnstGraphicsPort::getInterface()
const
41 void QnstGraphicsPort::setInterface(QString interface)
43 this->
interface = interface;
46 QString QnstGraphicsPort::getInterfaceUid()
const
51 void QnstGraphicsPort::setInterfaceUid(QString interfaceUid)
53 this->interfaceUid = interfaceUid;
56 void QnstGraphicsPort::draw(QPainter* painter)
58 painter->setBrush(Qt::black);
60 painter->drawRect(4 + 8/2, 4 + 8/2, getWidth()-8, getHeight()-8);
63 if (!isSelected() && hasMouseHover())
65 painter->setBrush(Qt::NoBrush);
66 painter->setPen(QPen(QBrush(QColor(
"#999999")), 0, Qt::DashLine));
68 painter->drawRect(4, 4, getWidth(), getHeight());
73 painter->setBrush(Qt::NoBrush);
74 painter->setPen(QPen(QBrush(Qt::black), 0));
76 painter->drawRect(getMoveLeft()+4-getLeft(),getMoveTop()+4-getTop(),getWidth()-1,getHeight()-1);
80 void QnstGraphicsPort::delineate(QPainterPath* painter)
const
82 painter->addRect(4 + 8/2, 4 + 8/2, getWidth()-8, getHeight()-8);
85 void QnstGraphicsPort::setProperties(
const QMap<QString, QString> &properties)
87 QnstGraphicsInterface::setProperties(properties);
89 setComponent(properties[
"component"]);
91 if (properties[
"componentUid"] !=
"")
92 setComponentUid(properties[
"componentUid"]);
96 setInterface(properties[
"interface"]);
98 if (properties[
"interfaceUid"] !=
"")
99 setInterfaceUid(properties[
"interfaceUid"]);
104 void QnstGraphicsPort::getProperties(QMap<QString, QString> &properties)
106 QnstGraphicsInterface::getProperties(properties);
108 properties[
"component"] = getComponent();
109 properties[
"componentUid"] = getComponentUid();
111 properties[
"interface"] = getInterface();
112 properties[
"interfaceUid"] = getInterfaceUid();