|
Maki
Formally verfied low-code orchestration
|
Represents a graphical node item in a flowchart. More...
#include <node.h>
Public Member Functions | |
| NodeItem (const QString &id, std::shared_ptr< NodeSaveInfo > info, const QPointF &initialPosition, std::shared_ptr< NodeConfig > nodeConfig, QGraphicsItem *parent=nullptr) | |
| Constructs a new NodeItem with the given parameters. | |
| virtual | ~NodeItem () |
| Destructor for the NodeItem. | |
| int | type () const override |
| Returns the type of this item. | |
| VoidResult | start () override |
| Starts the node. | |
| QRectF | nodeRect () const override |
| Returns the bounding rectangle for this item. | |
| QPainterPath | shape () const override |
| Returns the shape of this item. | |
| void | paint (QPainter *painter, const QStyleOptionGraphicsItem *style, QWidget *widget) override |
| Paints the item using the given painter. | |
| HelpConfig | help () const |
| Returns help configuration for this node. | |
| QString | nodeName () const |
| Returns the name of the node. | |
| QString | nodeType () const |
| Returns the type of the node. | |
| QString | behaviour () const |
| Returns the behavior of the node. | |
| QVector< ControlsConfig > | controls () const |
| Returns the controls configuration for this node. | |
| QVector< std::shared_ptr< IParameter > > | properties () const |
| Returns the properties of the node. | |
| QVector< PropertyConfig > | configurationProperties () const |
| Returns the configuration properties of the node. | |
| Types::LibraryTypes | function () const |
| Returns the library type associated with this node's function. | |
| const PropertyInfo * | getProperty (const QString &key) const |
| Gets a property by key. | |
| void | setProperty (const QString &key, const maki::Value &value) |
| Sets a property with a given key and value. | |
| void | renameNode (const QString &name) |
| Renames the node to a new name. | |
| NodeItem * | parentNode () const |
| Returns the parent node of this item. | |
| QVector< NodeItem * > | children () const |
| Returns a list of child nodes. | |
| QPointF | edgePointToward (const QPointF &targetScenePos) const |
| Calculates an edge point toward a target scene position. | |
| QVector< std::shared_ptr< IParameter > > | fields () const |
| Returns a list of fields associated with this node. | |
| PropertyInfo | getField (const QString &key) const |
| Gets a property info by key. | |
| VoidResult | setField (const QString &key, const QJsonObject &property) |
| Sets a field with a given key and JSON object. | |
| VoidResult | setField (const QString &key, std::shared_ptr< PropertyInfo > property) |
| Sets a field with a given key and PropertyInfo object. | |
| void | removeField (const QString &key) |
| Removes a field by key. | |
| void | setEvent (int index, const FlowConfig &event) |
| Sets an event at the given index with the provided FlowConfig. | |
| QVector< std::shared_ptr< IFlow > > | flowConfigs () const |
| Returns a list of events associated with this node. | |
| void | addParent (NodeItem *node) |
| Adds a parent node to this item. | |
| void | addChild (NodeItem *node, std::shared_ptr< NodeSaveInfo > info) |
| Adds a child node with the given save information. | |
| void | childRemoved (NodeItem *child) |
| Handles when a child is removed from this item. | |
| QVector< Flow * > | flows () const |
| Returns a list of flows associated with this node. | |
| Flow * | createFlow (const QString &flowName, std::shared_ptr< FlowSaveInfo > info) |
| Creates a new flow with the given name and save information. | |
| Flow * | getFlow (const QString &flowId) const |
| Gets a flow by its ID. | |
| void | deleteFlow (const QString &flowId) |
| Deletes a flow by its ID. | |
| void | updateFlow () |
| Updates all flows associated with this node. | |
| qreal | baseScale () const |
| Returns the base scale for this node. | |
| QVector< TransitionConfig > | configTransitions () const |
| Returns a list of configured transitions. | |
| void | applySize (const QSizeF &size) |
| Applies a new size to the node. | |
| void | updatePosition (const QPointF &position) |
| Updates the position of the node. | |
| NodeSaveInfo | saveInfo () const |
| Returns the savable information for this node. | |
| Public Member Functions inherited from NodeBase | |
| 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 QString | nodeId () const |
| Retrieves the identifier of the node within its type. | |
| 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 | |
| void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
| Handles mouse move events for this item. | |
| void | mousePressEvent (QGraphicsSceneMouseEvent *event) override |
| Handles mouse press events for this item. | |
| void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override |
| Handles mouse release events for this item. | |
| QVariant | itemChange (GraphicsItemChange change, const QVariant &value) override |
| Handles changes to the item's properties. | |
| Protected Member Functions inherited from NodeBase | |
| 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. | |
Private Member Functions | |
| void | updateExtrasPosition () |
| Size of the node when resizing started. | |
| QSizeF | clampSize (qreal width, qreal height) const |
| Clamps a size within valid limits. | |
| QPointF | clampPosInside (const QRectF &inner, const QRectF &childSceneRect) const |
| Clamps a position inside an inner rectangle. | |
| void | fitInsideParent (qreal padding) |
| Fits this node inside its parent with optional padding. | |
| QRectF | parentInnerSceneRect (qreal padding) const |
| Returns the inner scene rectangle of the parent, optionally padded. | |
Private Attributes | |
| QVector< Flow * > | mFlows |
| Save information for the node. | |
| NodeItem * | mParentNode |
| List of flows associated with this node. | |
| QVector< NodeItem * > | mChildrenNodes |
| Parent node of this item, if any. | |
| CanvasMessage * | mHighlightMessage = nullptr |
| List of child nodes. | |
| QSizeF | mSize {0, 0} |
| Base scale for the node. | |
| QPointF | mDragStartPos {0, 0} |
| Current size of the node. | |
| QPointF | mLastPosition {0, 0} |
| Position where dragging started. | |
| bool | mIsResizing {false} |
| Last known position of the node. | |
| QPointF | mResizeStartMousePos {0, 0} |
| Flag indicating if the node is being resized. | |
| QSizeF | mResizeStartSize {0, 0} |
| Mouse position when resizing started. | |
Friends | |
| QDataStream & | operator<< (QDataStream &out, const NodeItem &config) |
| Saves the state of this NodeItem to a QDataStream. | |
| QDataStream & | operator>> (QDataStream &in, NodeItem &config) |
| Loads the state of a NodeItem from a QDataStream. | |
Additional Inherited Members | |
| Protected Attributes inherited from NodeBase | |
| QGraphicsPixmapItem * | mPixmapItem = nullptr |
| Configuration settings for the node. | |
| QString | mIconPath = "" |
| Pointer to the pixmap item. | |
| QGraphicsSvgItem * | mIconItem = nullptr |
| Path to the icon image. | |
Represents a graphical node item in a flowchart.
| NodeItem::NodeItem | ( | const QString & | id, |
| std::shared_ptr< NodeSaveInfo > | info, | ||
| const QPointF & | initialPosition, | ||
| std::shared_ptr< NodeConfig > | nodeConfig, | ||
| QGraphicsItem * | parent = nullptr ) |
Constructs a new NodeItem with the given parameters.
| id | The unique identifier for the node. |
| info | The save information for the node. |
| initialPosition | The initial position of the node in scene coordinates. |
| nodeConfig | The configuration for the node. |
| parent | The parent graphics item, if any. |
| void NodeItem::addChild | ( | NodeItem * | node, |
| std::shared_ptr< NodeSaveInfo > | info ) |
Adds a child node with the given save information.
| node | The NodeItem to add as a child. |
| info | The save information for the child node. |
| void NodeItem::addParent | ( | NodeItem * | node | ) |
Adds a parent node to this item.
| node | The NodeItem to add as a parent. |
| void NodeItem::applySize | ( | const QSizeF & | size | ) |
Applies a new size to the node.
| size | The new QSizeF for the node. |
| qreal NodeItem::baseScale | ( | ) | const |
Returns the base scale for this node.
| QString NodeItem::behaviour | ( | ) | const |
Returns the behavior of the node.
| void NodeItem::childRemoved | ( | NodeItem * | child | ) |
Handles when a child is removed from this item.
| child | The NodeItem that was removed. |
| QVector< NodeItem * > NodeItem::children | ( | ) | const |
Returns a list of child nodes.
|
private |
Clamps a position inside an inner rectangle.
| inner | The inner QRectF. |
| childSceneRect | The scene rectangle of the child item. |
|
private |
Clamps a size within valid limits.
| width | The width to clamp. |
| height | The height to clamp. |
| QVector< TransitionConfig > NodeItem::configTransitions | ( | ) | const |
Returns a list of configured transitions.
| QVector< PropertyConfig > NodeItem::configurationProperties | ( | ) | const |
Returns the configuration properties of the node.
| QVector< ControlsConfig > NodeItem::controls | ( | ) | const |
Returns the controls configuration for this node.
| Flow * NodeItem::createFlow | ( | const QString & | flowName, |
| std::shared_ptr< FlowSaveInfo > | info ) |
Creates a new flow with the given name and save information.
| flowName | The name of the flow. |
| info | The save information for the flow. |
| void NodeItem::deleteFlow | ( | const QString & | flowId | ) |
Deletes a flow by its ID.
| flowId | The ID of the flow to delete. |
| QPointF NodeItem::edgePointToward | ( | const QPointF & | targetScenePos | ) | const |
Calculates an edge point toward a target scene position.
| targetScenePos | The target scene position. |
| QVector< std::shared_ptr< IParameter > > NodeItem::fields | ( | ) | const |
Returns a list of fields associated with this node.
|
private |
Fits this node inside its parent with optional padding.
| padding | The padding to apply when fitting. |
| QVector< std::shared_ptr< IFlow > > NodeItem::flowConfigs | ( | ) | const |
Returns a list of events associated with this node.
| QVector< Flow * > NodeItem::flows | ( | ) | const |
Returns a list of flows associated with this node.
| Types::LibraryTypes NodeItem::function | ( | ) | const |
Returns the library type associated with this node's function.
| PropertyInfo NodeItem::getField | ( | const QString & | key | ) | const |
Gets a property info by key.
| key | The property key. |
| Flow * NodeItem::getFlow | ( | const QString & | flowId | ) | const |
Gets a flow by its ID.
| flowId | The ID of the flow to retrieve. |
| const PropertyInfo * NodeItem::getProperty | ( | const QString & | key | ) | const |
Gets a property by key.
| key | The property key. |
| HelpConfig NodeItem::help | ( | ) | const |
Returns help configuration for this node.
|
overrideprotected |
Handles changes to the item's properties.
| change | The GraphicsItemChange enum value. |
| value | The new value for the property. |
|
overrideprotected |
Handles mouse move events for this item.
| event | The QGraphicsSceneMouseEvent object. |
|
overrideprotected |
Handles mouse press events for this item.
| event | The QGraphicsSceneMouseEvent object. |
|
overrideprotected |
Handles mouse release events for this item.
| event | The QGraphicsSceneMouseEvent object. |
| QString NodeItem::nodeName | ( | ) | const |
Returns the name of the node.
|
overridevirtual |
Returns the bounding rectangle for this item.
Reimplemented from NodeBase.
| QString NodeItem::nodeType | ( | ) | const |
Returns the type of the node.
|
override |
Paints the item using the given painter.
| painter | The painter to use for drawing. |
| style | The style option for the graphics item. |
| widget | The parent widget, if any. |
|
private |
Returns the inner scene rectangle of the parent, optionally padded.
| padding | The padding to apply. |
| NodeItem * NodeItem::parentNode | ( | ) | const |
Returns the parent node of this item.
| QVector< std::shared_ptr< IParameter > > NodeItem::properties | ( | ) | const |
Returns the properties of the node.
| void NodeItem::removeField | ( | const QString & | key | ) |
Removes a field by key.
| key | The property key to remove. |
| void NodeItem::renameNode | ( | const QString & | name | ) |
Renames the node to a new name.
| name | The new name for the node. |
| NodeSaveInfo NodeItem::saveInfo | ( | ) | const |
Returns the savable information for this node.
| void NodeItem::setEvent | ( | int | index, |
| const FlowConfig & | event ) |
Sets an event at the given index with the provided FlowConfig.
| index | The index of the event. |
| event | The FlowConfig object for the event. |
| VoidResult NodeItem::setField | ( | const QString & | key, |
| const QJsonObject & | property ) |
Sets a field with a given key and JSON object.
| key | The property key. |
| property | The QJsonObject representing the property. |
| VoidResult NodeItem::setField | ( | const QString & | key, |
| std::shared_ptr< PropertyInfo > | property ) |
Sets a field with a given key and PropertyInfo object.
| key | The property key. |
| property | The PropertyInfo object to set. |
| void NodeItem::setProperty | ( | const QString & | key, |
| const maki::Value & | value ) |
Sets a property with a given key and value.
| key | The property key. |
| value | The new value for the property. |
|
override |
Returns the shape of this item.
|
overridevirtual |
|
overridevirtual |
|
private |
Size of the node when resizing started.
Updates extra positions related to this node.
| void NodeItem::updatePosition | ( | const QPointF & | position | ) |
Updates the position of the node.
| position | The new QPointF for the node's position. |
|
friend |
|
friend |