OpenWalnut
1.5.0dev
|
Abstract class to distinguish between input- and output ports from a module. More...
#include <WQtNetworkPort.h>
Public Member Functions | |
virtual int | type () const =0 |
Reimplementation from QGraphicsItem. More... | |
virtual void | updateArrows () |
The position of every arrow connected with this port is updating its position in the scene. More... | |
virtual void | removeArrow (WQtNetworkArrow *arrow) |
Removes a specific arrow. More... | |
virtual void | removeArrows () |
Removes all connected arrows. More... | |
void | alignPosition (int size, int portNumber, QRectF rect, bool outPort) |
Calculates the position inside a item for each port to get a correct alignment. More... | |
virtual void | setOutPort (bool type) |
Set the type of the port. More... | |
virtual bool | isOutPort () |
Returns the porttype - true if outputport, false if inputport. More... | |
virtual QString | getPortName () |
Returns the portname. More... | |
virtual void | setPortName (QString str) |
Set the Name. More... | |
virtual int | getNumberOfArrows () |
Return the number of connections. More... | |
virtual void | addArrow (WQtNetworkArrow *arrow) |
Adds an arrow to the port. More... | |
virtual QList< WQtNetworkArrow * > | getArrowList () |
Get a QList of all arrows connected to this port. More... | |
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
Actually paints the port. More... | |
Static Public Member Functions | |
static float | getMultiplePortWidth (size_t nbPorts) |
Calculates the spaced needed for the given amount of ports. More... | |
Protected Member Functions | |
void | mousePressEvent (QGraphicsSceneMouseEvent *mouseEvent) |
Start drawing an arrow temporary. More... | |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *mouseEvent) |
Double click on port. More... | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *mouseEvent) |
Updates the temporary arrows endpoint. More... | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *mouseEvent) |
Send a connect request to kernel when start- and endport are connectable. More... | |
Protected Attributes | |
QList< WQtNetworkArrow * > | m_arrows |
the connected arrows More... | |
bool | m_isOutPort |
is the port an outport More... | |
QString | m_name |
the portname More... | |
Private Attributes | |
WQtNetworkArrow * | m_arrow |
The arrow used to connect items. More... | |
bool | m_brushNotSet |
used to indicate that the correct brush was not yet set. More... | |
Abstract class to distinguish between input- and output ports from a module.
This class handels if a connection between two ports is possible or not.
Definition at line 44 of file WQtNetworkPort.h.
|
virtual |
Adds an arrow to the port.
arrow | the arrow to add |
Definition at line 204 of file WQtNetworkPort.cpp.
References m_arrows.
Referenced by WQtNetworkEditor::event().
void WQtNetworkPort::alignPosition | ( | int | size, |
int | portNumber, | ||
QRectF | rect, | ||
bool | outPort | ||
) |
Calculates the position inside a item for each port to get a correct alignment.
size | the total number of ports ( distinguished by in- and outport |
portNumber | the number of the current port (distinguised by in- and outport |
rect | the rect of the parent item |
outPort | is it an in- or outport |
Definition at line 159 of file WQtNetworkPort.cpp.
Referenced by WQtNetworkItem::fitLook().
|
virtual |
Get a QList of all arrows connected to this port.
Definition at line 199 of file WQtNetworkPort.cpp.
References m_arrows.
|
static |
Calculates the spaced needed for the given amount of ports.
nbPorts | width of this amount of ports |
Definition at line 171 of file WQtNetworkPort.cpp.
Referenced by WQtNetworkItem::fitLook().
|
virtual |
Return the number of connections.
Definition at line 217 of file WQtNetworkPort.cpp.
References m_arrows.
|
virtual |
Returns the portname.
Definition at line 222 of file WQtNetworkPort.cpp.
References m_name.
Referenced by WQtNetworkInputPort::WQtNetworkInputPort(), and WQtNetworkOutputPort::WQtNetworkOutputPort().
|
virtual |
Returns the porttype - true if outputport, false if inputport.
Definition at line 237 of file WQtNetworkPort.cpp.
References m_isOutPort.
Referenced by paint(), WQtNetworkInputPort::WQtNetworkInputPort(), and WQtNetworkOutputPort::WQtNetworkOutputPort().
|
protected |
Double click on port.
mouseEvent | the event |
Definition at line 80 of file WQtNetworkPort.cpp.
References WQtNetworkInputPort::getConnector(), and WQtNetworkOutputPort::getConnector().
|
protected |
Updates the temporary arrows endpoint.
Arrow is colored green when connection possible, red if no connection is possible, or black when cursor doesent covers an WQtNetworkPort.
mouseEvent | the mouse event |
Definition at line 139 of file WQtNetworkPort.cpp.
References m_arrow, and WQtNetworkArrow::moveDrag().
|
protected |
Start drawing an arrow temporary.
mouseEvent | the mouse event |
Definition at line 113 of file WQtNetworkPort.cpp.
References m_arrow, and WQtNetworkArrow::startDrag().
|
protected |
Send a connect request to kernel when start- and endport are connectable.
mouseEvent | the mouse event |
Definition at line 147 of file WQtNetworkPort.cpp.
References WQtNetworkArrow::doneDrag(), and m_arrow.
|
virtual |
Actually paints the port.
painter | the painter |
option | style options |
widget | parent widget. |
Definition at line 52 of file WQtNetworkPort.cpp.
References isOutPort(), and m_brushNotSet.
|
virtual |
Removes a specific arrow.
arrow | an arrow |
Definition at line 176 of file WQtNetworkPort.cpp.
References m_arrows.
Referenced by WQtNetworkEditor::event(), and WQtNetworkArrow::~WQtNetworkArrow().
|
virtual |
Removes all connected arrows.
Definition at line 186 of file WQtNetworkPort.cpp.
References m_arrows.
|
virtual |
Set the type of the port.
type | true if out / false if in |
Definition at line 232 of file WQtNetworkPort.cpp.
References m_isOutPort, and type().
Referenced by WQtNetworkInputPort::WQtNetworkInputPort(), and WQtNetworkOutputPort::WQtNetworkOutputPort().
|
virtual |
Set the Name.
str | portname as string |
Definition at line 227 of file WQtNetworkPort.cpp.
References m_name.
Referenced by WQtNetworkInputPort::WQtNetworkInputPort(), and WQtNetworkOutputPort::WQtNetworkOutputPort().
|
pure virtual |
Reimplementation from QGraphicsItem.
Implemented in WQtNetworkOutputPort, and WQtNetworkInputPort.
Referenced by setOutPort().
|
virtual |
The position of every arrow connected with this port is updating its position in the scene.
Definition at line 209 of file WQtNetworkPort.cpp.
References m_arrows, and WQtNetworkArrow::updatePosition().
Referenced by WQtNetworkItem::positionChanged().
|
private |
The arrow used to connect items.
Definition at line 191 of file WQtNetworkPort.h.
Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
protected |
the connected arrows
Definition at line 181 of file WQtNetworkPort.h.
Referenced by addArrow(), getArrowList(), getNumberOfArrows(), removeArrow(), removeArrows(), and updateArrows().
|
private |
used to indicate that the correct brush was not yet set.
Definition at line 193 of file WQtNetworkPort.h.
Referenced by paint().
|
protected |
is the port an outport
Definition at line 183 of file WQtNetworkPort.h.
Referenced by isOutPort(), and setOutPort().
|
protected |
the portname
Definition at line 185 of file WQtNetworkPort.h.
Referenced by getPortName(), and setPortName().