I have two Qt
apps sharing a memory segment.
I would like to be able to emit a signal from App2 and trigger a slot from App1.
First off, I need to use QObject::connect()
to link the App2 signal to the App1 slot.
Is there a good way to connect two different Qt
processes signals/slots mechanisms? I've stumbled upon the qt-remote-signals library to send remote signals, which is using QDataStream
to serialize the object. QSharedMemory
uses the same class.
Or should I forget about connecting anything and just simulate a signal/slot behaviour?
- Write in the memory segment from App2
- Read the segment whenever it changes from App1 (how to know when it is updated?)
- Emit a custom signal from App1
- Trigger a slot from App1
Does that sound realistic ? I'm new to shared memory.
As far as I know, you can't connect Signal/Slot between processes. Also you cannot know 'naturaly' if another process have changed a QSharedMemory.
So I think you'll have to simulate it as you said.
If you need an instantly response (without making the App 1 checking time too small) from App1 you could make them comunicate using QLocalSocket/Server or D-Bus, butin that case you could go all in with them and manage all the comunication, making the QSharedMemory unnecesary.