Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any idea for running Qt signals/slots over network?

We're going to running remote GUI on a few PCs, all communicating with a central server where the main application is running. Instead of hacking our own manual network protocol and marshalling layer for button presses and various events, my hope is that this could be solved more cleverly somehow.

Indeed, it'd be nifty if you could autogenerate network proxies for these Qt objects, or somehow connect signals/slots across an RPC interface, or something like that.

  • Writing a code generator based on Qt's .ui files should be doable, but maybe someone else has tried this before (with or without success)?

  • Another idea would be to use PyQt and some mechanism in python for networked proxy objects.

  • Failing Qt specific stuff, how does one solve remote GUI in general?

(Using web server/client is not ok, as we need our Qt Style, and probably a more speedy GUI with more fancy widgets. )

like image 745
Macke Avatar asked Sep 07 '09 10:09

Macke


People also ask

How do I connect Qt signals and slots?

To connect the signal to the slot, we use QObject::connect(). There are several ways to connect signal and slots. The first is to use function pointers: connect(sender, &QObject::destroyed, this, &MyObject::objectDestroyed);

In what order will the slots be executed if they are connected to one signal?

According to Qt documentation: If several slots are connected to one signal, the slots will be executed one after the other, in the order they have been connected, when the signal is emitted.

How do Qt signals work?

The Qt signals/slots and property system are based on the ability to introspect the objects at runtime. Introspection means being able to list the methods and properties of an object and have all kinds of information about them such as the type of their arguments.


1 Answers

The Qxt extension library for Qt has a QxtRPCPeer class

QxtRPCPeer is a tool that encapsulates Qt signals and transmits them over a network connection. The signal is subsequently re-emitted on the receiving end of the connection.

Last Edit (Relevant OP's comment posted below on Feb 26 '11 at 16:23):

An update 1,5 years after. We've been using QxtRPCPeer in our production software for a year now. No glitches whatsoever.

Last Edit (By OP on 2015-05-22):

LibQxt is not maintained anymore, as of 0.6.2, as keeping up with the internal API changes is too much work for the authors. Some parts might still be usable but you'd have to maintain it yourself.

like image 121
TimW Avatar answered Sep 19 '22 23:09

TimW