I'm about to start writing a GUI for a modular synthesis app (like Alsa Modular Synth, Pure Data, Ingen) that will be used for patch (sound) editing.
What I need to do is something like this:
(source: drobilla.net)
(source: mcgill.ca)
So, basically, it's an area where I can draw some rectangles (boxes) that represent synth modules with input and output ports that I can connect with wires.
The problem is that I can't figure out how two create a widget for the editing area: Using a simple 2D drawing context where I draw the boxes manually seems to be the only logical way to do this, but doing this I loose all the great event management that qt gives me.
I'm wondering if there's the possibility of creating a custom layout that simply takes coordinates of created "boxes" and put them on the screen, so that I implement the boxes as subclasses of QWidget (and reusing qt's event handling system) and I add them to the window as I do usually.
Or maybe there's a better way?
Thank you
Take a look at QGraphicsScene and QGraphicsView. This way you will be able to create a scene filled with items. Each item can receive mouse events and you can manually paint it.