[Interest] porting a tcl gui to qt

Jonathan Wilkes jancsika at yahoo.com
Sun Jun 29 01:49:40 CEST 2014


Hello Qt people!


I'm a developer working on Pure Data, a realtime audio programming environment.  The program is made up of an audio/message system written in c which talk over a socket to a tcl/tk GUI.  I would like to port the GUI to Qt and am looking for some advice on the easiest way to achieve this.


A bit about the GUI first:  Pd programs are essentially little editable diagrams-- text inside boxes which are connected with straight lines or Bezier curves.  To draw the diagrams we use tk's canvas (actually tk path atm which includes svg-style grouping, but otherwise it is very similar).  Handling user interaction is crude but simple.  Tcl/tk sends "pd messages" ("selector arg1 arg2 etc. ;") to the pd process, and the pd process sends raw tcl commands to the gui (tcl's command syntax is fairly similar syntax to pd messages).

For example, if a user clicks at position 0 0 in the tk canvas, tcl/tk sends a message to the pd process over the socket:

.x19a1df0 mouse 0.0 0.0 1 0 ;

In this case, the selector is a name bound to a pd "canvas" object.  That object has a "mouse" method which checks to see if there's any object at position (0.0 0.0) on that canvas.  If there is, Pd calls that object's "click" function.  If it needs to update its visual appearance, it sends a tcl/tk command over the socket to the GUI:


.x19a1df0.c itemconfigure .x19a1df0.t19a3710R -strokewidth 5


In tk when you create a widget, that widget's name (.x19a1df0.c here) becomes a command to be used to manipulate the widget.  So here, I'm just increasing the border width for some visual feedback.

I know this is an extremely inefficient design (especially for a realtime audio environment), but there are enough UX quirks that changing the design _and_ porting at the same time without breaking anything would be more work than we have resources for.  So I'm wondering how to do something similar to this, either with the QGraphicsView or Qt Quick and the Scene Graph.  I think I can figure out how to get Qt to send pd messages over the socket, but what's the best way to send messages to the Qt GUI to tell it to draw things on the "canvas" or update their properties?

Thanks,
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140628/f4cc582f/attachment.html>


More information about the Interest mailing list