Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
draggable.h
1#pragma once
2
3#include <QGraphicsRectItem>
4#include <QGraphicsScene>
5#include <QGraphicsView>
6#include <QJsonValueConstRef>
7#include <QLabel>
8#include <QMimeData>
9#include <QString>
10#include <QWidget>
11#include <memory>
12
13#include "config.h"
14#include "node_base.h"
15#include "types.h"
16
20class DraggableItem : public NodeBase
21{
22public:
23 enum
24 {
25 Type = Types::DRAGGABLE
26 };
27
35 DraggableItem(const QString& id, std::shared_ptr<NodeConfig> config, QGraphicsItem* parent = nullptr);
36
40 virtual ~DraggableItem();
41
47 int type() const override;
48
54 void adjustWidth(int width);
55
61 void startDrag(QGraphicsSceneMouseEvent* event);
62
68 void handleClick(QGraphicsSceneMouseEvent* event);
69
75 QPainterPath shape() const override;
76
84 void paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) override;
85
91 QRectF nodeRect() const override;
92};
void startDrag(QGraphicsSceneMouseEvent *event)
Starts a drag operation based on the given mouse event.
Definition draggable.cpp:64
QPainterPath shape() const override
Returns the shape of this item for collision detection.
Definition draggable.cpp:53
DraggableItem(const QString &id, std::shared_ptr< NodeConfig > config, QGraphicsItem *parent=nullptr)
Constructs a new DraggableItem with the given ID, configuration, and parent.
Definition draggable.cpp:17
QRectF nodeRect() const override
Returns the bounding rectangle of this item.
Definition draggable.cpp:39
void adjustWidth(int width)
Adjusts the width of the item.
Definition draggable.cpp:58
void handleClick(QGraphicsSceneMouseEvent *event)
Handles a click event based on the given mouse event.
Definition draggable.cpp:103
void paint(QPainter *painter, const QStyleOptionGraphicsItem *style, QWidget *widget) override
Paints this item using the given painter and style options.
Definition draggable.cpp:44
int type() const override
Returns the type of this item.
Definition draggable.cpp:34
virtual std::shared_ptr< NodeConfig > config() const
Retrieves the configuration settings for the node.
Definition node_base.cpp:57
NodeBase(const QString &id, const QString &nodeId, std::shared_ptr< NodeConfig > config, QGraphicsItem *parent)
Constructs a new NodeBase instance.
Definition node_base.cpp:19