Link Item (linkitem)

class orangecanvas.canvas.items.linkitem.LinkItem(parent=None, **kwargs)[source]

Bases: PyQt5.QtWidgets.QGraphicsWidget

A Link item in the canvas that connects two NodeItems in the canvas.

The link curve connects two Anchor items (see setSourceItem() and setSinkItem()). Once the anchors are set the curve automatically adjusts its end points whenever the anchors move.

An optional source/sink text item can be displayed above the curve’s central point (setSourceName(), setSinkName())


Signal emitted when the item has been activated (double-click)


Signal emitted the the item’s selection state changes.


Z value of the item

class State(value)

Bases: enum.IntEnum

Flags indicating the runtime state of a link

NoState = 0

The link has no associated state.

Empty = 1

Link is empty; the source node does not have any value on output

Active = 2

Link is active; the source node has a valid value on output

Pending = 4

The link is pending; the sink node is scheduled for update

Invalidated = 8

The link’s input is marked as invalidated (not yet available).

setSourceItem(item, signal=None, anchor=None)[source]

Set the source item (NodeItem). Use anchor (AnchorPoint) as the curve start point (if None a new output anchor will be created using item.newOutputAnchor()).

Setting item to None and a valid anchor is a valid operation (for instance while mouse dragging one end of the link).

setSinkItem(item, signal=None, anchor=None)[source]

Set the sink item (NodeItem). Use anchor (AnchorPoint) as the curve end point (if None a new input anchor will be created using item.newInputAnchor()).

Setting item to None and a valid anchor is a valid operation (for instance while mouse dragging one and of the link).


Set the visibility of the channel name text.


Set the name of the source (used in channel name text).


Return the source name.


Set the name of the sink (used in channel name text).


Return the sink name.


Set the link item animation enabled state.

mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)[source]
hoverEnterEvent(self, QGraphicsSceneHoverEvent)[source]
hoverLeaveEvent(self, QGraphicsSceneHoverEvent)[source]
changeEvent(self, QEvent)[source]
sceneEventFilter(self, QGraphicsItem, QEvent) bool[source]
boundingRect(self) QRectF[source]
shape(self) QPainterPath[source]

Reimplemented from QGraphicWidget

Set link enabled state. When disabled the link is rendered with a dashed line.

isEnabled(self) bool[source]

Set the link’s dynamic enabled state.

If the link is dynamic it will be rendered in red/green color respectively depending on the state of the dynamic enabled state.


Is the link dynamic enabled.


Mark the link as dynamic (i.e. it responds to setDynamicEnabled()).


Is the link dynamic.


Style the link appropriate to the LinkItem.State


state (LinkItem.State) –

itemChange(self, QGraphicsItem.GraphicsItemChange, Any) Any[source]