Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
NodeBase Class Reference

Base class for all graphical nodes. More...

#include <node_base.h>

Inheritance diagram for NodeBase:
DraggableItem NodeItem

Public Member Functions

 NodeBase (const QString &id, const QString &nodeId, std::shared_ptr< NodeConfig > config, QGraphicsItem *parent)
 Constructs a new NodeBase instance.
virtual ~NodeBase ()
 Destructor.
QString id () const
 Retrieves the unique identifier of the node.
virtual int type () const override
 Returns the type of the node.
virtual QString nodeId () const
 Retrieves the identifier of the node within its type.
virtual VoidResult start ()
 Starts the node.
virtual std::shared_ptr< NodeConfig > config () const
 Retrieves the configuration settings for the node.
virtual QRectF boundingRect () const override
 Returns the bounding rectangle of the node.
virtual QRectF labelBoundingRect () const
 Returns the bounding rectangle of the label.
virtual QRectF scaledRect () const
 Returns the scaled rectangle of the node.
virtual QRectF drawingRect (const QRectF &input) const
 Returns the drawing rectangle based on the input rectangle.
virtual QPainterPath nodeShape (const QRectF &bounds) const
 Returns the node shape as a QPainterPath.
void paintNode (const QRectF &bounds, const QColor &background, const QPen &text, QPainter *painter)
 Paints the node using the provided painter.
virtual QPixmap nodePixmap () const
 Retrieves the pixmap of the node.
virtual QString nodeIcon () const
 Retrieves the icon path of the node.
virtual void toggleLabelVisibility ()
 Toggles the visibility of the label.

Protected Member Functions

virtual void setPixmap (const QPixmap &pixmap)
 Pointer to the SVG icon item.
virtual void setIcon (const QString &path, const QColor &iconColor)
 Sets the icon for the node.
virtual void setLabel (const QString &name, qreal fontSize)
 Sets the label text and font size.
virtual void setLabelName (const QString &name)
 Sets the label text.
virtual void setLabelSize (qreal fontSize, const QSizeF &boundingSize)
 Sets the font size and bounding size for the label.
virtual void paintLabel (QPainter *painter, const QRectF &area, const QPen &pen) const
 Paints the label using the provided painter.
virtual void paintPixmap (QPainter *painter) const
 Paints the pixmap using the provided painter.

Protected Attributes

QGraphicsPixmapItem * mPixmapItem = nullptr
 Configuration settings for the node.
QString mIconPath = ""
 Pointer to the pixmap item.
QGraphicsSvgItem * mIconItem = nullptr
 Path to the icon image.

Private Member Functions

qreal computeScaleFactor () const
 Scaled bounding rectangle of the node.

Private Attributes

const QRectF mBounds
 Unique identifier of the node.
QString mLabelText
 Bounding rectangle of the node.

Detailed Description

Base class for all graphical nodes.

Constructor & Destructor Documentation

◆ NodeBase()

NodeBase::NodeBase ( const QString & id,
const QString & nodeId,
std::shared_ptr< NodeConfig > config,
QGraphicsItem * parent )

Constructs a new NodeBase instance.

Parameters
idUnique identifier for the node.
nodeIdIdentifier of the node within its type.
configConfiguration settings for the node.
parentParent QGraphicsItem.

Member Function Documentation

◆ boundingRect()

QRectF NodeBase::boundingRect ( ) const
overridevirtual

Returns the bounding rectangle of the node.

Returns
The bounding rectangle.

◆ computeScaleFactor()

qreal NodeBase::computeScaleFactor ( ) const
private

Scaled bounding rectangle of the node.

Computes the scale factor for the node.

Returns
The computed scale factor.

◆ config()

std::shared_ptr< NodeConfig > NodeBase::config ( ) const
virtual

Retrieves the configuration settings for the node.

Returns
The configuration settings.

◆ drawingRect()

QRectF NodeBase::drawingRect ( const QRectF & input) const
virtual

Returns the drawing rectangle based on the input rectangle.

Parameters
inputInput rectangle.
Returns
The drawing rectangle.

◆ id()

QString NodeBase::id ( ) const

Retrieves the unique identifier of the node.

Returns
The unique identifier.

◆ labelBoundingRect()

QRectF NodeBase::labelBoundingRect ( ) const
virtual

Returns the bounding rectangle of the label.

Returns
The bounding rectangle of the label.

◆ nodeIcon()

QString NodeBase::nodeIcon ( ) const
virtual

Retrieves the icon path of the node.

Returns
The icon path of the node.

◆ nodeId()

QString NodeBase::nodeId ( ) const
virtual

Retrieves the identifier of the node within its type.

Returns
The identifier of the node within its type.

◆ nodePixmap()

QPixmap NodeBase::nodePixmap ( ) const
virtual

Retrieves the pixmap of the node.

Returns
The pixmap of the node.

◆ nodeShape()

QPainterPath NodeBase::nodeShape ( const QRectF & bounds) const
virtual

Returns the node shape as a QPainterPath.

Parameters
boundsBounding rectangle of the node.
Returns
The node shape.

◆ paintLabel()

void NodeBase::paintLabel ( QPainter * painter,
const QRectF & area,
const QPen & pen ) const
protectedvirtual

Paints the label using the provided painter.

Parameters
painterPainter to use for drawing.
areaArea to paint the label in.

◆ paintNode()

void NodeBase::paintNode ( const QRectF & bounds,
const QColor & background,
const QPen & text,
QPainter * painter )

Paints the node using the provided painter.

Parameters
boundsBounding rectangle of the node.
backgroundBackground color for the node.
textText pen for the label.
painterPainter to use for drawing.

◆ paintPixmap()

void NodeBase::paintPixmap ( QPainter * painter) const
protectedvirtual

Paints the pixmap using the provided painter.

Parameters
painterPainter to use for drawing.

◆ scaledRect()

QRectF NodeBase::scaledRect ( ) const
virtual

Returns the scaled rectangle of the node.

Returns
The scaled rectangle.

◆ setIcon()

void NodeBase::setIcon ( const QString & path,
const QColor & iconColor )
protectedvirtual

Sets the icon for the node.

Parameters
pathPath to the icon image.
iconColorColor of the icon.

◆ setLabel()

void NodeBase::setLabel ( const QString & name,
qreal fontSize )
protectedvirtual

Sets the label text and font size.

Parameters
nameThe label text.
fontSizeFont size for the label.

◆ setLabelName()

void NodeBase::setLabelName ( const QString & name)
protectedvirtual

Sets the label text.

Parameters
nameThe label text.

◆ setLabelSize()

void NodeBase::setLabelSize ( qreal fontSize,
const QSizeF & boundingSize )
protectedvirtual

Sets the font size and bounding size for the label.

Parameters
fontSizeFont size for the label.
boundingSizeBounding size for the label.

◆ setPixmap()

void NodeBase::setPixmap ( const QPixmap & pixmap)
protectedvirtual

Pointer to the SVG icon item.

Sets the pixmap for the node.

Parameters
pixmapThe new pixmap.

◆ start()

VoidResult NodeBase::start ( )
virtual

Starts the node.

Returns
A VoidResult indicating success or failure.

Reimplemented in NodeItem.

◆ type()

int NodeBase::type ( ) const
overridevirtual

Returns the type of the node.

Returns
The type of the node.

Reimplemented in DraggableItem, and NodeItem.


The documentation for this class was generated from the following files:
  • /__w/maki/maki/app/elements/node_base.h
  • /__w/maki/maki/app/elements/node_base.cpp