19 #include <QGraphicsScene>
26 : QGraphicsPathItem(parent)
28 , m_direction(direction)
29 , m_port_type(port_type)
42 setPen(QPen(
m_color.darker(180)));
45 setFlag(QGraphicsItem::ItemSendsScenePositionChanges);
56 conn->setSelected(
false);
85 if (conn->port1() == other || conn->port2() == other)
95 return QColor(Qt::gray);
97 return QColor(Qt::yellow);
99 return QColor(Qt::green);
101 return QColor(Qt::blue);
103 return QColor(Qt::magenta);
105 return QColor(Qt::red);
111 if (change == ItemScenePositionHasChanged) {
113 conn->updatePosFromPorts();
123 m_label =
new QGraphicsTextItem(
this);
130 -
m_label->boundingRect().height() / 2);
Defines class DesignerHelper.
Defines class NodeEditorConnection.
Defines class NodeEditorPort.
DefinesStyleUtils namespace.
static int getPortFontSize()
void append(NodeEditorConnection *connection)
virtual ~NodeEditorPort()
NodeEditorPort(QGraphicsItem *parent=0, const QString &name="unnamed", EPortDirection direction=INPUT, EPortType port_type=DEFAULT)
void remove(NodeEditorConnection *connection)
EPortType
type of ports, same type can be connected together
QVector< NodeEditorConnection * > m_connections
EPortDirection m_direction
static QColor getPortTypeColor(NodeEditorPort::EPortType port_type)
EPortDirection
port direction
QVariant itemChange(GraphicsItemChange change, const QVariant &value)
void setLabel(QString name)
QGraphicsTextItem * m_label
QString const & name(EShape k)
QSize SizeOfLetterM(const QWidget *widget=nullptr)
Returns size of largest letter of default system font.