Vuo  0.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
VuoRendererPort Class Reference

Description

Renders a node's port in a QGraphicsScene.

Typically automatically created by a VuoRendererNode instance.

Public Member Functions

 VuoRendererPort (VuoPort *basePort, VuoRendererSignaler *signaler, bool isOutput, bool isReceptorPort=false, bool isFunctionPort=false)
 Creates a renderer detail for the specified base port.
 
QRectF boundingRect (void) const
 Returns the bounding rectangle of this port (and its optional name and plug).
 
QPainterPath shape (void) const
 Returns the shape of the rendered port, for use in collision detection, hit tests, and QGraphicsScene::items() functions.
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 Draws an input or output port (both standard ports and receptor/function ports).
 
void setEligibleForConnection (bool eligible)
 Sets the boolean indicating whether this port is eligible for connection to the cable currently being dragged between ports.
 
bool canConnectTo (VuoRendererPort *toPort)
 Returns a boolean indicating whether there may be a cable attached from this port to toPort, taking into account the respective port types (input vs.
 
bool isConnectedTo (VuoRendererPort *toPort)
 Returns a boolean indicating whether there is a cable connecting this port to toPort.
 
bool getInput (void) const
 Returns a boolean indicating whether this port is an input port.
 
bool getOutput (void) const
 Returns a boolean indicating whether this port is an output port.
 
bool getFunctionPort (void) const
 Returns a boolean indicating whether this port is a function port.
 
bool hasConnectedCable (void) const
 Returns a boolean indicating whether this port has any attached cables.
 
bool hasConnectedDataCable (void) const
 Returns a boolean indicating whether this port has any attached data+event cables.
 
bool grabRangeIncludes (QPointF scenePos)
 Returns a boolean indicating whether a cable connected to this port as its 'To' port would be permitted to be disconnected by dragging from scenePos, taking into account the distance between scenePos and this port.
 
void updateGeometry ()
 Schedules a redraw of this port.
 
QPainterPath getPortPath (qreal inset, qreal drawerOffset) const
 Returns a closed path representing the port's circle, constant flag, or attached drawer.
 
QRectF getPortRect (void) const
 Returns a rectangle encompassing the port's circle.
 
VuoTypegetDataType (void) const
 Returns the data type associated with this port, or NULL if there is no associated data type.
 
bool isConstant (void) const
 Returns true if this port has a constant data value.
 
string getConstantAsString (void) const
 Returns the string representation of this port's constant data value, or an empty string if it has none.
 
VuoRendererNodegetParentNode (void) const
 Returns the node to which this port belongs.
 
VuoRendererPortgetTypecastParentPort ()
 Returns this node's typecast parent port, or NULL if it has none.
 
void setTypecastParentPort (VuoRendererPort *typecastParentPort)
 Sets this node's typecast parent port.
 
bool supportsDisconnectionByDragging (void)
 Returns a boolean indicating whether this port supports cable disconnection by dragging from the port.
 
- Public Member Functions inherited from VuoBaseDetail< VuoPort >
 VuoBaseDetail (string id, VuoPort *base)
 Creates a VuoNode detail class.
 
VuoPortgetBase (void) const
 Returns the VuoNode detail class instance's base class instance.
 
void setBase (VuoPort *base)
 Sets the VuoNode detail class instance's base class instance.
 

Static Public Member Functions

static QPointF getPlugOffset (void)
 Returns the offset creating a "plug" teminating a cable going into this port.
 
- Static Public Member Functions inherited from VuoRendererItem
static void setDrawBoundingRects (bool drawBoundingRects)
 Specifies whether bounding rects will be shown the next time the QGraphicsScene is rendered.
 

Static Public Attributes

static const qreal portSpacing = VuoRendererNode::thickPenWidth*3.0/4.0
 Vertical distance, in pixels at 1:1 zoom, between the center points of two ports.
 
static QFont nodePortTitleFont
 Font used for rendering port titles and constant values.
 

Protected Member Functions

void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 Handle mouse double-click events.
 
void keyPressEvent (QKeyEvent *event)
 Handle key-press events.
 
void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
 Handle mouse hover start events.
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 Handle mouse hover leave events.
 
QRectF getNameRect () const
 
QPainterPath getPortConstantPath (QRectF innerPortRect, QString text) const
 
QRectF getPortConstantTextRect (QString text, bool isConnected, bool isTypecast) const
 Returns the drawer attached to this port, or NULL if none.
 
QPainterPath getFunctionPortGlyph (void) const
 Returns a path representing the glyph for function ports.
 
void paintPortName (QPainter *painter)
 
- Protected Member Functions inherited from VuoRendererItem
void drawBoundingRect (QPainter *painter)
 Draws this item's bounding rect, for debugging.
 

Protected Attributes

bool isReceptorPort
 

Friends

class TestVuoRenderer
 

Member Function Documentation

bool VuoRendererPort::canConnectTo ( VuoRendererPort toPort)

Returns a boolean indicating whether there may be a cable attached from this port to toPort, taking into account the respective port types (input vs.

output; event-only vs. event+data; string data vs. integer data).

QRectF VuoRendererPort::getPortConstantTextRect ( QString  text,
bool  isConnected,
bool  isTypecast 
) const
protected

Returns the drawer attached to this port, or NULL if none.

Returns a rect enclosing the specified text, optionally leaving room for a cable plug.


The documentation for this class was generated from the following files: