QNodeEditor.graphics.node.NodeGraphics#

class QNodeEditor.graphics.node.NodeGraphics(node: Node, theme: ~typing.Type[~QNodeEditor.themes.theme.Theme] = <class 'QNodeEditor.themes.dark.DarkTheme'>)#

Bases: QGraphicsItem

Extension of QGraphicsItem for drawing a node.

Properties

height

Get the height of the node.

theme

Get or set the theme of the node.

width

Get or set the width of the node.

Methods

__init__

Create new node graphics.

boundingRect

Get the bounding rectangle of the node.

get_entry_geometry

Determine the top-left position of an entry relative to the node top-left corner.

hoverEnterEvent

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

hoverLeaveEvent

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

itemChange

Update the node and connected edges if it was moved.

paint

Draw the node.

set_title

Change the title of the node.

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

Create new node graphics.

Parameters:
  • node (Node) – Node these graphics are for

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

get_entry_geometry(entry: Entry) tuple[QPointF, float]#

Determine the top-left position of an entry relative to the node top-left corner.

Parameters:

entry (Entry) – Entry to calculate geometry for

Returns:

Top-left position and available width for the given entry.

Return type:

tuple[QPointF, float]

set_title(title: str) None#

Change the title of the node.

The title is automatically truncated if it would exceed the width of the node.

Parameters:

title (str) – New title for the node

Return type:

None

property height: float#

Get the height of the node.

property theme: Type[Theme]#

Get or set the theme of the node.

Setting the theme will apply the theme to all children elements.

property width: float#

Get or set the width of the node.