Maki
Formally verified low-code orchestration
Loading...
Searching...
No Matches
repeat_node.h
1#pragma once
2
3#include "elements/behaviour/behaviour_node.h"
4
5class SubFlow;
6class SubFlowMarker;
7
8class RepeatNode : public BehaviourNode
9{
10public:
11 RepeatNode(const QString& id, std::shared_ptr<NodeSaveInfo> info, const QPointF& initialPosition, std::shared_ptr<NodeConfig> nodeConfig,
12 QGraphicsItem* parent = nullptr);
13
14 VoidResult start() override;
15 SubFlow* subFlow() const;
16
17 void addChild(NodeItem* node, std::shared_ptr<NodeSaveInfo> info) override;
18 void childRemoved(NodeItem* child) override;
19 QRectF sceneAlignRect() const override;
20
21 QRectF nodeRect() const override;
22 QPainterPath shape() const override;
23
24 void setProperty(const QString& key, const maki::Value& value) override;
25
26protected:
27 QRectF extraBoundingRect() const override;
28 QPointF constrainChildPosition(const NodeItem* child, const QPointF& proposedPosition) const override;
29 void childPositionUpdated(NodeItem* child) override;
30 QRectF childAreaSceneRect(const QString& subflow) const override;
31 bool constrainChildren() const override;
32 void updateExtrasPosition(Config::NodeMove reason) override;
33
34 void createPorts() override;
35 virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value) override;
36
37 void paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) override;
38 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
39
40private:
41 void layoutSubFlow();
42 void layoutSubFlowMarkers();
43
44 SubFlow* mSubFlow{nullptr};
45
46 void toggleCollapsed(SubFlow* flow, bool collapsed);
47};
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.
Definition node.cpp:29
void addChild(NodeItem *node, std::shared_ptr< NodeSaveInfo > info) override
Adds a child node with the given save information.
Definition repeat_node.cpp:129
QPainterPath shape() const override
Returns the shape of this item.
Definition repeat_node.cpp:78
VoidResult start() override
Starts the node.
Definition repeat_node.cpp:31
void updateExtrasPosition(Config::NodeMove reason) override
Updates extra positions related to this node.
Definition repeat_node.cpp:83
void childRemoved(NodeItem *child) override
Handles when a child is removed from this item.
Definition repeat_node.cpp:135
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
Handles changes to the item's properties.
Definition repeat_node.cpp:334
void setProperty(const QString &key, const maki::Value &value) override
Sets a property with a given key and value.
Definition repeat_node.cpp:141
QRectF nodeRect() const override
Returns the bounding rectangle for this item.
Definition repeat_node.cpp:69
void childPositionUpdated(NodeItem *child) override
Called to tell the parent that the position of this node was updated.
Definition repeat_node.cpp:89
void paint(QPainter *painter, const QStyleOptionGraphicsItem *style, QWidget *widget) override
Paints the item using the given painter.
Definition repeat_node.cpp:345
Definition sub_flow.h:13