forked from paceholder/nodeeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
43 lines (31 loc) · 1.07 KB
/
main.cpp
File metadata and controls
43 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <QtNodes/DataFlowGraphModel>
#include <QtNodes/DataFlowGraphicsScene>
#include <QtNodes/GraphicsView>
#include <QtNodes/NodeData>
#include <QtNodes/NodeDelegateModelRegistry>
#include <QtWidgets/QApplication>
#include "TextDisplayDataModel.hpp"
#include "TextSourceDataModel.hpp"
using QtNodes::DataFlowGraphicsScene;
using QtNodes::DataFlowGraphModel;
using QtNodes::GraphicsView;
using QtNodes::NodeDelegateModelRegistry;
static std::shared_ptr<NodeDelegateModelRegistry> registerDataModels()
{
auto ret = std::make_shared<NodeDelegateModelRegistry>();
ret->registerModel<TextSourceDataModel>();
ret->registerModel<TextDisplayDataModel>();
return ret;
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
std::shared_ptr<NodeDelegateModelRegistry> registry = registerDataModels();
DataFlowGraphModel dataFlowGraphModel(registry);
DataFlowGraphicsScene scene(dataFlowGraphModel);
GraphicsView view(&scene);
view.setWindowTitle("Node-based flow editor");
view.resize(800, 600);
view.show();
return app.exec();
}