[Interest] porting a tcl gui to qt

Konrad Rosenbaum konrad at silmor.de
Tue Jul 1 09:38:53 CEST 2014


On Tue, July 1, 2014 00:05, Jonathan Wilkes wrote:
> On 06/30/2014 03:30 PM, Alejandro Exojo wrote:
> I suppose I am looking for a kind of UI protocol.  Here's another
> question-- do you know any cross-platform apps with a Qt GUI that talks
> to the "main" process over a socket?

I've written a few of those - I always wrote the protocol myself on top of
QTcpSocket or QLocalSocket.

The protocol you are using right now is probably a good starting point -
you'll just have to write your command parser yourself.

I recommend using a registry(*) for your main items and use their IDs just
like you used the Tk item/widget names as "command", then interpret the
remainder of the commands - it usually is a simple matter of using
QString::split and handing the result to some hierarchy of methods to do
the evaluation of the components.

(*) QMap<int,QGraphicsItem*>registry; or the better
QMap<int,QPointer<MyPdItemClass> >; with MyPdItemClass containing enough
logic to work in the context of your program as well as taking care of
item deletion, etc.

I would also recommend updating the protocol to exchange high-level
information instead of actual widget commands - more like "item1234
setActive 1" instead of ".item1234 setColor green".


   Konrad




More information about the Interest mailing list