25 #ifndef WQTNETWORKPORT_H
26 #define WQTNETWORKPORT_H
28 #include <QGraphicsRectItem>
29 #include <QGraphicsPolygonItem>
30 #include <QGraphicsLineItem>
32 #include "WQtNetworkArrow.h"
33 #include "WQtNetworkPort.h"
55 virtual int type()
const = 0;
84 void alignPosition(
int size,
int portNumber, QRectF rect,
bool outPort );
138 virtual void paint( QPainter* painter,
const QStyleOptionGraphicsItem* option, QWidget* widget );
This Class is needed for connecting two ports and drawing a line between them.
Abstract class to distinguish between input- and output ports from a module.
void alignPosition(int size, int portNumber, QRectF rect, bool outPort)
Calculates the position inside a item for each port to get a correct alignment.
static float getMultiplePortWidth(size_t nbPorts)
Calculates the spaced needed for the given amount of ports.
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
Updates the temporary arrows endpoint.
virtual void removeArrow(WQtNetworkArrow *arrow)
Removes a specific arrow.
WQtNetworkArrow * m_arrow
The arrow used to connect items.
QList< WQtNetworkArrow * > m_arrows
the connected arrows
QString m_name
the portname
virtual void updateArrows()
The position of every arrow connected with this port is updating its position in the scene.
virtual void removeArrows()
Removes all connected arrows.
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
Send a connect request to kernel when start- and endport are connectable.
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent)
Double click on port.
bool m_isOutPort
is the port an outport
virtual void setOutPort(bool type)
Set the type of the port.
virtual bool isOutPort()
Returns the porttype - true if outputport, false if inputport.
bool m_brushNotSet
used to indicate that the correct brush was not yet set.
virtual QString getPortName()
Returns the portname.
virtual void setPortName(QString str)
Set the Name.
virtual int type() const =0
Reimplementation from QGraphicsItem.
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
Start drawing an arrow temporary.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Actually paints the port.
virtual QList< WQtNetworkArrow * > getArrowList()
Get a QList of all arrows connected to this port.
virtual void addArrow(WQtNetworkArrow *arrow)
Adds an arrow to the port.
virtual int getNumberOfArrows()
Return the number of connections.