Re: Designing a Node Editor (Hint: Blender Node Editor)
I implemented once something similar. I did it with a QGraphicsScene and different graphics items. There is also a QGraphicsProxyWidget class that lets you include widgets in your graphic items.
For the ports (or slots) I implemented a small class that was basically a pointer to another node. So every node could have a list of input and output ports that could be connected to each other.
Some cues:
- I had a base class for nodes that had a list of input ports and one of output nodes. Either of the list could be empty.
- The ports had some logic so you could't connect output ports with other output ports (or inputs with inputs), and each port knew with which node it's connected.
- If you drag a node all the connections (cables) of the node need to be redrawn.
I can't provide you with the source code since the project was proprietary. And it wasn't very nicely implemented because it was an internship project (basically my first bigger SW project.
But if you need some more details or suggestions, feel free to ask.
If your code is open source I'm interested in the result.
Regards Luke
Using Qt 4.7
Developping on Win 7 and XP
Using Qt Creator, Eclipse and Visual Studio
Target Platforms Win, Linux and soon OS X
Bookmarks