View Full Version : Display from multiple processes in one GUI

17th September 2009, 16:51
I'm working on an app that communicates with different pieces of hardware and displays graphics based on the hardware outputs. The hardware can be a bit flakey, though. I'd like to structure the main app so that, like Chrome, each graphics display is it's own process, so that one crashing doesn't bring down the entire app. While the easiest solution would be to just have a different QMainWindow for each piece of hardware, each one started by a QProcess, the inputs from the hardware are synced. Because of that, it would be nice to have them side-by-side in one main window.

Any suggestions on the best way to run GUI elements from different processes within one main window?


17th September 2009, 17:33
Hi there,

Have you looked at the QmdiArea class? This allows you to view multiple documents in a single window, you may be able to use this for you application.


17th September 2009, 17:50

That could cover the display aspect, but there's still the issue of getting the GUI element from the child element (which is actually a separate process) to draw inside the main window. I've got a feeling that QSharedMemory might be part of the solution, but I've never used it and am trying to get a feel for how to use it correctly.

17th September 2009, 21:08
QSharedMemory might be a suitable solution but only if the images are simple or of constant size. If you want to have things such as resizing the main window, QSharedMemory might become a burden because of a varying size of the data to transfer (although still possible to use). If you're targeting Linux and Windows, DBus would be the best solution (although it would require of you to deploy DBus on the Windows system). Apart from that the simplest solution I can think of is a socket (UDP or local) and QDataStream to stream through images.