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())

activated

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

selectedChanged

Signal emitted the the item’s selection state changes.

Z_VALUE = 0

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).

setChannelNamesVisible(visible)[source]

Set the visibility of the channel name text.

setSourceName(name)[source]

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

sourceName()[source]

Return the source name.

setSinkName(name)[source]

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

sinkName()[source]

Return the sink name.

setAnimationEnabled(enabled)[source]

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]
setEnabled(enabled)[source]

Reimplemented from QGraphicWidget

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

isEnabled(self) bool[source]
setDynamicEnabled(enabled)[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.

isDynamicEnabled()[source]

Is the link dynamic enabled.

setDynamic(dynamic)[source]

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

isDynamic()[source]

Is the link dynamic.

setRuntimeState(state)[source]

Style the link appropriate to the LinkItem.State

Parameters

state (LinkItem.State) –

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