QNodeEditor.graphics.edge.EdgeGraphics#

class QNodeEditor.graphics.edge.EdgeGraphics(edge: Edge, theme: ~typing.Type[~QNodeEditor.themes.theme.Theme] = <class 'QNodeEditor.themes.dark.DarkTheme'>)#

Bases: QGraphicsPathItem

Extension of QGraphicsPathItem for drawing an edge.

This class is abstract. It serves as a base class for various edge types.

Properties

pos_end

Get or set the scene ending position of the edge.

pos_start

Get or set the scene starting position of the edge.

Methods

__init__

Create new edge graphics.

boundingRect

Get the bounding rectangle of the edge.

create_path

Abstract method that calculates the path of the edge.

hoverEnterEvent

Update the edge graphics if the mouse is hovered over it.

hoverLeaveEvent

Update the edge graphics if the mouse stops hovering over it.

intersects_line

Checks whether a line segment intersects with this edge.

paint

Draw the edge

shape

Get the shape of the edge.

__init__(edge: Edge, theme: ~typing.Type[~QNodeEditor.themes.theme.Theme] = <class 'QNodeEditor.themes.dark.DarkTheme'>)#

Create new edge graphics.

Parameters:
  • edge (Edge) – Edge these graphics are for

  • theme (Type[Theme], optional) – Theme for the edge graphics (default: DarkTheme)

abstract create_path() QPainterPath#

Abstract method that calculates the path of the edge.

Returns:

Path connecting start and end point

Return type:

QPainterPath

intersects_line(point1: QPointF, point2: QPointF) bool#

Checks whether a line segment intersects with this edge.

Parameters:
  • point1 (QPointF) – Line segment starting point

  • point2 (QPointF) – Line segment end point

Returns:

Whether the line segment intersects the edge

Return type:

bool

property pos_end: QPointF#

Get or set the scene ending position of the edge.

property pos_start: QPointF#

Get or set the scene starting position of the edge.