paceholder / nodeeditor Goto Github PK
View Code? Open in Web Editor NEWQt Node Editor. Dataflow programming framework
License: BSD 3-Clause "New" or "Revised" License
Qt Node Editor. Dataflow programming framework
License: BSD 3-Clause "New" or "Revised" License
Hi,
First of all, thanks for this very nice piece of software.
I am currently working on Ubuntu 14.04 (I am stacked to that version for several reasons).
I had to do some changes to downgrade the code. Not many indeed.
Would you be interested to "downgrade" your requirements to allow a broader availability of your library?
I can send you a Pull request, if you agree.
Cheers
Davide
So a useful feature to me would be diffenent colors for different NodeDataType
s to make different types easily differentiated.
This kind of goes against the styling you recently implemented, but there are a few ways around that.
Have a QColor
member in NodeDataType
and just use that for rendering. It might be nice to have different colors for hover, select etc or just they are made lighter for hover etc.
A style theme defines a bunch of possible colors that could be used for connections, based on the color scheme they are going for, then they are assigned to be different for different data types.
I personally like approach 2 better because it follows color schemes and doesn't need each NodeDataType
to define all their own custom colors, it just works and it looks good but you can't like assign red to a specific data type (which isn't really a loss IMHO because that would break color scheming anyways).
I'm willing to write the code for it :).
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/39601225-diffenent-colors-for-different-nodedatatypes?utm_campaign=plugin&utm_content=tracker%2F34672389&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F34672389&utm_medium=issues&utm_source=github).From the examples, it seems that there cannot be two outbound edges coming from the same port of a node. Is this a hard limitation on the library or could it be easily lifted ? (Or I just couldn't manage to do it).
Thanks !
This library is awesome, tested it using Qt but I could really make use of it using Python/Pyside2.
Any chance somebody would be savvy enough to generate python bindings for this ?
Thanks !
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
What I get now on my QHD+ screen looks terrible.
Qt documentation suggests to define a boolean environment variable
export QT_AUTO_SCREEN_SCALE_FACTOR=1
This scales the application but fonts are bad and the nodes look pixelized.
Ideas:
QGraphicsObject
cachingQt::AA_EnableHighDpiScaling
I need to implement a feature to lock/unlock the position of Connections and Nodes (and prevent deleting).
I can work on it myself and send you a PR, it you agree with this enhancement.
For the records, I would prefer the latter, but it is just personal taste. This is your code, you decide ;)
It would be nice to be able to select nodes in a marquee selection.
Left-click is currently used for moving the viewport + nodes, so maybe right click for marquee?
I know you had troubles with travis+newer compilers.
You should check out https://github.com/mikkeloscar/arch-travis which sets up a archlinux chroot inside the VM. This is useful because arch has really new packages (clang 3.9, g++ 6.2.1)
That's what I use for chigraph and it's really nice :).
The builds do take a bit longer (90ish seconds)
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/39466792-c-14-with-ci?utm_campaign=plugin&utm_content=tracker%2F34672389&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F34672389&utm_medium=issues&utm_source=github).Hi, awesome product with one small issue:
The Node editor calculator example crashes when loading a second .flow file after an initial load. loading a new graph in its place causes an memory access violation whenever FlowScene::load() calls _connections.clear();
I'm using Visual Studio 2015 Community on Windows 10 with Qt 5.7.
I think it'd be useful to have context menus for nodes. I also think it'd be useful for the user to be able to configure which actions are there, or maybe even totally custom action menus.
Another possibility is you could be able to set the ContextMenuPolicy
to allow for custom context menus entirely on nodes.
What is the best way to go about this? Some sort of addNodeContextAction
?
Hi. I'm trying to compile nodes in VS 2015, but I'm getting dozens of compiler errors "error syntax ::" .
I have no idea what is wrong as it seems correct.
Any Idea what it may be?
The github PR interface is a bit lacking (in my opinion).
I have used reviewable.io on other projects and it is quite nice.
(You don't even have to enable it, you can preview it by looking at my new PRs on it)
https://reviewable.io/reviews/paceholder/nodeeditor/28#-
https://reviewable.io/reviews/paceholder/nodeeditor/29#-
Would it be possible to release the software with an more permissive license like MIT or LGPL?
GPL is a good license, but it restricts usage to "open source only".
Rigth now I can't use the library in proprietary software. I know that this software depends on QT, but QT can be used under the LGPL which allows the usage in proprietary software, as long as it is dynamically linked.
The scrolling issue (outlined in the readme) where you have to move nodes to resize the scene is really annoying, and I found a fix for it.
mView->setSceneRect(-320000, -320000, 640000, 640000);
mView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
mView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Just makes the scene huge and turns scrollbars off. Not super clean, but the best way to do it.
http://stackoverflow.com/questions/19207153/how-to-pan-beyond-the-scrollbar-range-in-a-qgraphicsview
I experimented a bit with your library and it seems that I can only run in interactive mode (Showing the editor). It would be cool if I could design a flow in the editor, save it to a file and run the saved file without the need for the editor itself.
For example: The unreal engine uses a similar editor system called "Blueprints" where you can visually design program flow. But after shipping, the editor itself is not needed anymore and the generated files can be interpreted by it's own.
Currently, there are 4 places which stream to std::cout
(one of them is commented out):
std::cout << "Remove ConnectionGraphicsObject from scene" << std::endl;
//std::cout << "Properties already have a value with the name '"
std::cout << "Connection destructor" << std::endl;
std::cout << "Node destructor" << std::endl;
These clutter stdout. Either they should be removed, or replaced with the QMessageLogger system.
For example:
Node::
~Node()
{
qCInfo(QLoggingCategory("QtNodes")) << "Node destructor";
}
This way, users of the library could customize the output of the log messages if necessary. The exact way of initializing the QLoggingCategory
might have to be different, but a quick test shows that this seems to work with qInstallMessageHandler()
Given a graph that the user constructed, I need to be able to access the topology of the graph.
Currently, it almost seems possible with FlowScene::nodes()
and FlowScene::connections()
, but although Connection
is defined through its header, Node
is not. Node
is merely forward declared. If Node.hpp was visible or #include
'd somewhere, it would work.
Does the "Save.." button work for anyone in the Calculator example? I looked at the main.cpp
in the calculator subdirectory and it seems like FlowScene::save()
should save the graph in some sort of .flow
file. Does anyone know whether they are able to save their graphs?
Hi. First of all, thanks for this fantastic library!
I've recently started to use it, but , for my needs, I would need to show some data in each port
This is from Unreal Blueprint editor, but you can get the idea, show some data between the port name and the port connection...
Is it possible to do something like this?. I'm looking at the source code, but some clues from you would be great.
Thanks in advance
As mentioned in #26 it would be nice to have a headless mode. But for this to work, there should be a seperation between the visual representation and the code execution.
Binary files are compact but difficult to read without special tools. A structured text document should be a decent solution.
A useful feature (at least for me) would be runtime-defined types. As of right now, only subclasses of NodeDataModel
(that must be defined at compile time) can be used as node types.
I am willing to form a PR for this with a little guidance on how this should be implemented.
Want to back this issue? ** Post a bounty on it!** We accept bounties via Bountysource.
I'm not able with the example to remove a node or a link.
It is possible?
Is OSX not supported or wasn't it just tested yet?
Hello,
I have the following case in my software: the main structure I manipulate is a time-line
Now, for some of the relationships I have on the time-line, I'd like to get a visual representation with nodeeditor (that the user wouldn't really be able to change). But the examples seem to imply that creating nodes should only be done from the GUI.
What would be the best way to create nodes from code, layout them in the scene, add connections? thanks
I was thinking it might be nice (for you and your users) to have a "showcase" section in the readme showcasing some of the projects that use your library.
It would show that it is actually well used and that it is chosen by other developers.
What do you think? If you're OK with it I'll file a PR adding chigraph to it...
I am new to cmake and am trying to get the calculator example running for the first time.
Here is a step by step of what I did to try to compile and run the example:
CMakeLists.txt
file is located) I created a subdirectory -> mkdir build
cd build
cmake ..
make
After running make I get this error:
fatal error: QtCore/QObject: No such file or directory
#include <QtCore/QObject>
^
compilation terminated.
make[2]: *** [CMakeFiles/calculator.dir/ModuloModel.o] Error 1
make[1]: *** [CMakeFiles/calculator.dir/all] Error 2
make: *** [all] Error 2
I am not sure what the right way to go about setting the include paths for the Qt libraries. Any help would be appreciated.
I don't fully understand what is going on with the scene geometry. For example, if (in the flow view) I want to place a node's center under the mouse cursor:
auto pos = this->mapToScene(event->pos());
auto shift = _scene->getNodeSize(node) / 2.f;
pos = {pos.x() - shift.width(), pos.y() - shift.height()};
_scene->setNodePosition(node, pos);
This works correctly. However, with this code, nodes are off:
auto pos = this->mapToScene(event->pos());
auto shift = node.nodeGraphicsObject().boundingRect().size() / 2.f; // wrong?
pos = {pos.x() - shift.width(), pos.y() - shift.height()};
_scene->setNodePosition(node, pos);
Similarly, if I do something like this:
fitInView(scene()->itemsBoundingRect(), Qt::KeepAspectRatio);
I would expect all nodes to fit in the view nicely. Instead, the zoom is too strong and also the view is somewhat displaced. Why does the QGraphicsScene get the bounding rectangle wrong?
I've noticed that some nodes don't show captions or even port labels if they are too long.
For example, if you change SubtractionModel::caption
in SubtractionModel.hpp
to:
return QString("Subtraction1233456789012345678901234567890");
It appears like this:
I haven't really looked at the rendering code yet, so I don't know where to look to form a PR.
Interestingly enough, it is dependent on the embeddedWidget
. All of the below nodes have the caption somelongstring
:
yet only the one with the embedded widget has the caption...
I think the trust should be put in the developer for not creating a name that is too long (I have had this issue with significantly shorter names and it makes things quite unreadable)
Tried to build on Windows 10 by Qt 5.5.1 mingw 4.9.2/ There is build log:
D:\workplace\_nodeeditor\build>mingw32-make
Scanning dependencies of target nodes_autogen
[ 1%] Automatic MOC for target nodes
Generating MOC source nodes_autogen/UVLADIE3JM/moc_Connection.cpp
Generating MOC source nodes_autogen/UVLADIE3JM/moc_ConnectionGraphicsObject.cpp
Generating MOC source nodes_autogen/UVLADIE3JM/moc_FlowItemInterface.cpp
Generating MOC source nodes_autogen/UVLADIE3JM/moc_FlowScene.cpp
Generating MOC source nodes_autogen/UVLADIE3JM/moc_Node.cpp
Generating MOC source nodes_autogen/UVLADIE3JM/moc_NodeDataModel.cpp
Generating MOC source nodes_autogen/UVLADIE3JM/moc_NodeGraphicsObject.cpp
Generating MOC compilation nodes_autogen/moc_compilation.cpp
[ 1%] Built target nodes_autogen
[ 3%] Generating qrc_resources.cpp
Scanning dependencies of target nodes
[ 5%] Building CXX object CMakeFiles/nodes.dir/src/Connection.cpp.obj
D:\workplace\_nodeeditor\src\Connection.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "Connection.hpp"
^
[ 6%] Building CXX object CMakeFiles/nodes.dir/src/ConnectionBlurEffect.cpp.obj
D:\workplace\_nodeeditor\src\ConnectionBlurEffect.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "ConnectionBlurEffect.hpp"
^
[ 8%] Building CXX object CMakeFiles/nodes.dir/src/ConnectionGeometry.cpp.obj
D:\workplace\_nodeeditor\src\ConnectionGeometry.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "ConnectionGeometry.hpp"
^
[ 10%] Building CXX object CMakeFiles/nodes.dir/src/ConnectionGraphicsObject.cpp.obj
D:\workplace\_nodeeditor\src\ConnectionGraphicsObject.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "ConnectionGraphicsObject.hpp"
^
[ 11%] Building CXX object CMakeFiles/nodes.dir/src/ConnectionPainter.cpp.obj
D:\workplace\_nodeeditor\src\ConnectionPainter.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "ConnectionPainter.hpp"
^
[ 13%] Building CXX object CMakeFiles/nodes.dir/src/ConnectionState.cpp.obj
D:\workplace\_nodeeditor\src\ConnectionState.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "ConnectionState.hpp"
^
[ 15%] Building CXX object CMakeFiles/nodes.dir/src/ConnectionStyle.cpp.obj
D:\workplace\_nodeeditor\src\ConnectionStyle.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "ConnectionStyle.hpp"
^
[ 16%] Building CXX object CMakeFiles/nodes.dir/src/DataModelRegistry.cpp.obj
D:\workplace\_nodeeditor\src\DataModelRegistry.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "DataModelRegistry.hpp"
^
[ 18%] Building CXX object CMakeFiles/nodes.dir/src/FlowItemInterface.cpp.obj
D:\workplace\_nodeeditor\src\FlowItemInterface.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "FlowItemInterface.hpp"
^
[ 20%] Building CXX object CMakeFiles/nodes.dir/src/FlowScene.cpp.obj
D:\workplace\_nodeeditor\src\FlowScene.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "FlowScene.hpp"
^
[ 22%] Building CXX object CMakeFiles/nodes.dir/src/FlowView.cpp.obj
D:\workplace\_nodeeditor\src\FlowView.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "FlowView.hpp"
^
[ 23%] Building CXX object CMakeFiles/nodes.dir/src/FlowViewStyle.cpp.obj
D:\workplace\_nodeeditor\src\FlowViewStyle.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "FlowViewStyle.hpp"
^
[ 25%] Building CXX object CMakeFiles/nodes.dir/src/Node.cpp.obj
D:\workplace\_nodeeditor\src\Node.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "Node.hpp"
^
[ 27%] Building CXX object CMakeFiles/nodes.dir/src/NodeConnectionInteraction.cpp.obj
D:\workplace\_nodeeditor\src\NodeConnectionInteraction.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "NodeConnectionInteraction.hpp"
^
[ 28%] Building CXX object CMakeFiles/nodes.dir/src/NodeDataModel.cpp.obj
D:\workplace\_nodeeditor\src\NodeDataModel.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "NodeDataModel.hpp"
^
[ 30%] Building CXX object CMakeFiles/nodes.dir/src/NodeGeometry.cpp.obj
D:\workplace\_nodeeditor\src\NodeGeometry.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "NodeGeometry.hpp"
^
[ 32%] Building CXX object CMakeFiles/nodes.dir/src/NodeGraphicsObject.cpp.obj
D:\workplace\_nodeeditor\src\NodeGraphicsObject.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "NodeGraphicsObject.hpp"
^
[ 33%] Building CXX object CMakeFiles/nodes.dir/src/NodePainter.cpp.obj
D:\workplace\_nodeeditor\src\NodePainter.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "NodePainter.hpp"
^
[ 35%] Building CXX object CMakeFiles/nodes.dir/src/NodeState.cpp.obj
D:\workplace\_nodeeditor\src\NodeState.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "NodeState.hpp"
^
[ 37%] Building CXX object CMakeFiles/nodes.dir/src/NodeStyle.cpp.obj
D:\workplace\_nodeeditor\src\NodeStyle.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "NodeStyle.hpp"
^
[ 38%] Building CXX object CMakeFiles/nodes.dir/src/Properties.cpp.obj
D:\workplace\_nodeeditor\src\Properties.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "Properties.hpp"
^
[ 40%] Building CXX object CMakeFiles/nodes.dir/src/StyleCollection.cpp.obj
D:\workplace\_nodeeditor\src\StyleCollection.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "StyleCollection.hpp"
^
[ 42%] Building CXX object CMakeFiles/nodes.dir/qrc_resources.cpp.obj
D:\workplace\_nodeeditor\build\qrc_resources.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
/****************************************************************************
^
[ 44%] Building CXX object CMakeFiles/nodes.dir/nodes_autogen/moc_compilation.cpp.obj
D:\workplace\_nodeeditor\build\nodes_autogen\moc_compilation.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
/* This file is autogenerated, do not edit*/
^
[ 45%] Linking CXX shared library bin\libnodes.dll
[ 45%] Built target nodes
Scanning dependencies of target connection_colors_autogen
[ 47%] Automatic MOC for target connection_colors
Generating MOC source connection_colors_autogen/EWIEGA46WW/moc_models.cpp
Generating MOC compilation connection_colors_autogen/moc_compilation.cpp
[ 47%] Built target connection_colors_autogen
Scanning dependencies of target connection_colors
[ 49%] Building CXX object examples/connection_colors/CMakeFiles/connection_colors.dir/main.cpp.obj
D:\workplace\_nodeeditor\examples\connection_colors\main.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include <QtWidgets/QApplication>
^
[ 50%] Building CXX object examples/connection_colors/CMakeFiles/connection_colors.dir/models.cpp.obj
D:\workplace\_nodeeditor\examples\connection_colors\models.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
#include "models.hpp"
^
[ 52%] Building CXX object examples/connection_colors/CMakeFiles/connection_colors.dir/connection_colors_autogen/moc_compilation.cpp.obj
D:\workplace\_nodeeditor\build\examples\connection_colors\connection_colors_autogen\moc_compilation.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
/* This file is autogenerated, do not edit*/
^
[ 54%] Linking CXX executable ..\..\bin\connection_colors.exe
CMakeFiles\connection_colors.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZSt11make_uniqueI14NaiveDataModelIEENSt9_MakeUniqIT_E15__single_objectEDpOT0_[__ZSt11make_uniqueI14NaiveDataModelIEENSt9_MakeUniqIT_E15__single_objectEDpOT0_]+0x4a): undefined reference to `QtNodes::StyleCollection::nodeStyle()'
CMakeFiles\connection_colors.dir/objects.a(moc_compilation.cpp.obj):moc_compilation.cpp:(.text$_ZNK14NaiveDataModel5cloneEv[__ZNK14NaiveDataModel5cloneEv]+0x49): undefined reference to `QtNodes::StyleCollection::nodeStyle()'
collect2.exe: error: ld returned 1 exit status
examples\connection_colors\CMakeFiles\connection_colors.dir\build.make:155: recipe for target 'bin/connection_colors.exe' failed
mingw32-make[2]: *** [bin/connection_colors.exe] Error 1
CMakeFiles\Makefile2:185: recipe for target 'examples/connection_colors/CMakeFiles/connection_colors.dir/all' failed
mingw32-make[1]: *** [examples/connection_colors/CMakeFiles/connection_colors.dir/all] Error 2
makefile:82: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
It seems there is no way to make use of Qt Stylesheets for setting the colors and linewidths for Nodes and Connections.
I think it would be sufficient to set styles in the form of JSON documents:
NodeStyle::setStyle({ "CornerRadius" : 5,
"Color" : [ 100, 100, 0 ],
"TextColor : [ 255, 255, 255 ],
"BorderColor : [ 10, 10, 255 ]
"FontSize" : 12
});
Is there any way to dynamically change the number of In and Out ports on a node that has already been created?
It would be cleaner if you had a common prefix to classes (like Qt has the Q prefix, KF5 has the K prefix, etc) or were in a namespace (like the standard library) to be able to differentiate from classes not in your library.
The plus of putting them in a namespace is that people who want the same behavior as before can use insert a using namespace XXX
statement.
Just some food for thought
The tool-tip text must be defined by the NodeDataModel.
The current way of implementing the headers in the include
folder makes the use of installed library impossible. This must be reworked to the structure as follows:
include/
nodes/
public *.hpp files
src/
private *.hpps
*.cpps
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.