Maki
Formally verified low-code orchestration
Loading...
Searching...
No Matches
library_scene.h
1#pragma once
2
3#include <QApplication>
4#include <QGraphicsItem>
5#include <QGraphicsScene>
6#include <QMouseEvent>
7
8#include "elements/draggable.h"
9
13class LibraryScene : public QGraphicsScene
14{
15 Q_OBJECT
16public:
22 explicit LibraryScene(QObject* parent = nullptr);
23
29 QRectF visibleItemsBounds() const;
30
37 bool filterNodes(const QString& query);
38
42 void themeChanged();
43
44 void setDraggable(bool draggable);
45
46signals:
52 void libraryNodeSelected(const QString& nodeType, const QString& instanceId);
53
54 void dragStarted(const QString& nodeType);
55 void dragCancelled(const QString& nodeType);
56
57protected:
63 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
64
70 void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
71
77 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
78
84 void contextMenuEvent(QGraphicsSceneContextMenuEvent* event) override;
85
86private:
87 QPointF mPressScenePos;
88 bool mSupportsDrags = true;
89 bool mPressed = false;
90 bool mDragging = false;
92
96 void clearSelectedNodes();
97};
A draggable item in a graphical scene.
Definition draggable.h:21
void themeChanged()
Handles theme change events.
Definition library_scene.cpp:156
bool mDragging
Flag indicating if mouse is currently pressed.
Definition library_scene.h:90
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Handles mouse press events in the scene.
Definition library_scene.cpp:18
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Handles mouse release events in the scene.
Definition library_scene.cpp:79
bool mPressed
Flag indicating whether this scene accepts node dragging.
Definition library_scene.h:89
bool filterNodes(const QString &query)
Filters nodes based on a query string.
Definition library_scene.cpp:117
LibraryScene(QObject *parent=nullptr)
Constructs a new LibraryScene object.
Definition library_scene.cpp:11
QRectF visibleItemsBounds() const
Returns the bounding rectangle of all visible items in the scene.
Definition library_scene.cpp:139
bool mSupportsDrags
Scene position where mouse was pressed.
Definition library_scene.h:88
void libraryNodeSelected(const QString &nodeType, const QString &instanceId)
Emitted when a library node is selected.
DraggableItem * mClickedItem
Flag indicating if dragging is in progress.
Definition library_scene.h:91
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override
Handles context menu events in the scene.
Definition library_scene.cpp:102
void clearSelectedNodes()
Pointer to the item that was clicked.
Definition library_scene.cpp:107
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
Handles mouse move events in the scene.
Definition library_scene.cpp:48