Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
library_container.h
1#pragma once
2
3#include <QGraphicsView>
4
5#include "config.h"
6#include "result.h"
7
11class LibraryContainer : public QGraphicsView
12{
13 Q_OBJECT
14public:
20 LibraryContainer(QWidget* parent = nullptr);
21
29 static LibraryContainer* create(const QString& name, QWidget* parent);
30
38 VoidResult addNode(const QString& id, std::shared_ptr<NodeConfig> config);
39
46 bool filterNodes(const QString& query);
47
51 void setColumnCount(int count);
52
53protected:
59 void resizeEvent(QResizeEvent* event) override;
60
61private:
62 int mLastItemY;
63 int mColumnCount = 2;
64
68 void updateSceneSize();
69
73 void relayoutItems();
74};
bool filterNodes(const QString &query)
Filters nodes based on the given query string.
Definition library_container.cpp:86
int mColumnCount
The last Y position of an item in the scene.
Definition library_container.h:63
void resizeEvent(QResizeEvent *event) override
Handles resize events for the LibraryContainer.
Definition library_container.cpp:80
void setColumnCount(int count)
Update the number of columns in the library.
Definition library_container.cpp:74
VoidResult addNode(const QString &id, std::shared_ptr< NodeConfig > config)
Adds a node with the given ID and configuration to the library.
Definition library_container.cpp:63
void relayoutItems()
Update layout after a column change.
Definition library_container.cpp:98
LibraryContainer(QWidget *parent=nullptr)
Constructs a new LibraryContainer with the given parent widget.
Definition library_container.cpp:15
static LibraryContainer * create(const QString &name, QWidget *parent)
Creates and returns a new LibraryContainer instance with the specified name and parent widget.
Definition library_container.cpp:24
void updateSceneSize()
Updates the size of the scene based on the current view size.
Definition library_container.cpp:48