loom
1#include <QtNodes/DataFlowGraphModel>
2#include <QtNodes/DataFlowGraphicsScene>
3#include <QtNodes/GraphicsView>
4#include <QtNodes/NodeData>
5#include <QtNodes/NodeDelegateModelRegistry>
6
7#include <QtWidgets/QApplication>
8
9#include "TextDisplayDataModel.hpp"
10#include "TextSourceDataModel.hpp"
11
12using QtNodes::DataFlowGraphicsScene;
13using QtNodes::DataFlowGraphModel;
14using QtNodes::GraphicsView;
15using QtNodes::NodeDelegateModelRegistry;
16
17static std::shared_ptr<NodeDelegateModelRegistry> registerDataModels()
18{
19auto ret = std::make_shared<NodeDelegateModelRegistry>();
20
21ret->registerModel<TextSourceDataModel>();
22ret->registerModel<TextDisplayDataModel>();
23
24return ret;
25}
26
27int main(int argc, char *argv[])
28{
29QApplication app(argc, argv);
30
31std::shared_ptr<NodeDelegateModelRegistry> registry = registerDataModels();
32DataFlowGraphModel dataFlowGraphModel(registry);
33
34DataFlowGraphicsScene scene(dataFlowGraphModel);
35
36GraphicsView view(&scene);
37
38view.setWindowTitle("Node-based flow editor");
39view.resize(800, 600);
40view.show();
41
42return app.exec();
43}
44